Sponsored Content
Top Forums Programming Client/Server Socket Application - Preventing Client from quitting on server crash Post 302348223 by Corona688 on Thursday 27th of August 2009 04:43:51 PM
Old 08-27-2009
It may be getting SIGPIPE when trying to write to a closed socket. To handle signals, see man sigaction. On the other hand your application may just be deciding to throw in the towel recv() returns <= 0.
 

10 More Discussions You Might Find Interesting

1. Programming

UDP socket - can both client and server recv and send

Hi, Am very new to socket programming. When we use UDP sockets to communicate between two processess, will both the client/server socket be able to send/recv ? meaning can sendto()/ recvfrom() be used on both server and client? It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies

2. UNIX for Dummies Questions & Answers

socket programming : client server IPC

I'm new to socket programming. Have a basic doubt. I have a structure(global) at the server side. I have two different client connecting to the server. Will the changes made by one client on the structure be visible to the other client when it accesses the same client? I'm creating a STREAM... (3 Replies)
Discussion started by: abc.working
3 Replies

3. Programming

Server - Client application problem

hi all I'm beginner in CORBA Server-Client appliction development. My server- client application was worked well and i have tested it too. Due to some Network problem we have rebooted our dedicated server , then i restart my corba service, application in the server it started... (0 Replies)
Discussion started by: VijayakumarN
0 Replies

4. UNIX for Dummies Questions & Answers

Running server side application on client demand

Ive written a java based "webscraper to rss feed" which resides on my college web space when I execute the app from putty it creates the feed and sets the permissions perfectly.I then wrote a php script to execute the app on demand from the browser using ... system("java -cp... (1 Reply)
Discussion started by: gleesonger
1 Replies

5. Programming

how can I send and receive data in client server socket programing

char name; printf ("Welcome to the server \n"); printf ("Enter user name: \n"); scanf ("%c", &name); how can client send name to server:what should be the code? int send ( int sid , const char ∗buffer Ptr , int len , int f l a g ) how can client receive ack from... (1 Reply)
Discussion started by: saiful_911
1 Replies

6. Programming

socket programing in client server

hei, i want to enter name and read it by client server socket program after checking name validity put the password and check.if ok than server clirnt say correct other wise incorrect. below my code: char name; printf ("Welcome to the server \n"); printf ("Enter user name: \n"); scanf... (1 Reply)
Discussion started by: saiful_911
1 Replies

7. Windows & DOS: Issues & Discussions

Office server => laptop =>client server ...a lengthy and laborious ftp procedure

Hi All, I need your expertise in finding a way to solve my problem.Please excuse if this is not the right forum to ask this question and guide me to the correct forum,if possible. I am a DBA and on a daily basis i have to ftp huge dump files from my company server to my laptop and then... (3 Replies)
Discussion started by: kunwar
3 Replies

8. Programming

C Socket Client/Server Fork Loop

Hello people. I'm trying to do something like a search engine. Server runs in the background by using ./server & which has data from a textfile stored in an array. Client then runs by using ./client It will then prompt "Search for:" For example, if I searched for Products called Instant... (0 Replies)
Discussion started by: andylbh
0 Replies

9. Programming

Client accidently close when the server crash

The steps to test the problem 1. Open TCP Server 2. Open TCP Client 3. TCP Client sends data to Server. 4. Close TCP Server and the client also crash without any notification Second wonderful test: 1. Comment the following statement in Client.c (at line 168) and compile it Writen(... (1 Reply)
Discussion started by: sehang
1 Replies

10. Programming

Socket dual client/server Linux

I'm trying to make a "dual/server client" (ipv4,ipv6) with sockets in linux but i don't know how to join both codes. I have a dual client ipv4 and ipv6, but i have problems with the server if you notice the only difference between them it's the AF_INET (pf_inet ipv4, and if_inet6 ipv6) and the port... (3 Replies)
Discussion started by: godna
3 Replies
recv(3XNET)					   X/Open Networking Services Library Functions 				       recv(3XNET)

NAME
recv - receive a message from a connected socket SYNOPSIS
cc [ flag ... ] file ... -lxnet [ library ... ] #include <sys/socket.h> ssize_t recv(int socket, void *buffer, size_t length, int flags); DESCRIPTION
The recv() function receives a message from a connection-mode or connectionless-mode socket. It is normally used with connected sockets because it does not permit the application to retrieve the source address of received data. The function takes the following arguments: socket Specifies the socket file descriptor. buffer Points to a buffer where the message should be stored. length Specifies the length in bytes of the buffer pointed to by the buffer argument. flags Specifies the type of message reception. Values of this argument are formed by logically OR'ing zero or more of the fol- lowing values: MSG_PEEK Peeks at an incoming message. The data is treated as unread and the next recv() or similar func- tion will still return this data. MSG_OOB Requests out-of-band data. The significance and semantics of out-of-band data are protocol-spe- cific. MSG_WAITALL Requests that the function block until the full amount of data requested can be returned. The function may return a smaller amount of data if a signal is caught, if the connection is termi- nated, if MSG_PEEK was specified, or if an error is pending for the socket. The recv() function returns the length of the message written to the buffer pointed to by the buffer argument. For message-based sockets such as SOCK_DGRAM and SOCK_SEQPACKET, the entire message must be read in a single operation. If a message is too long to fit in the sup- plied buffer, and MSG_PEEK is not set in the flags argument, the excess bytes are discarded. For stream-based sockets such as SOCK_STREAM, message boundaries are ignored. In this case, data is returned to the user as soon as it becomes available, and no data is discarded. If the MSG_WAITALL flag is not set, data will be returned only up to the end of the first message. If no messages are available at the socket and O_NONBLOCK is not set on the socket's file descriptor, recv() blocks until a message arrives. If no messages are available at the socket and O_NONBLOCK is set on the socket's file descriptor, recv() fails and sets errno to EAGAIN or EWOULDBLOCK. USAGE
The recv() function is identical to recvfrom(3XNET) with a zero address_len argument, and to read() if no flags are used. The select(3C) and poll(2) functions can be used to determine when data is available to be received. RETURN VALUES
Upon successful completion, recv() returns the length of the message in bytes. If no messages are available to be received and the peer has performed an orderly shutdown, recv() returns 0. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The recv() function will fail if: EAGAIN The socket's file descriptor is marked O_NONBLOCK and no data is waiting to be received; or MSG_OOB is set and no EWOULDBLOCK out-of-band data is available and either the socket's file descriptor is marked O_NONBLOCK or the socket does not support blocking to await out-of-band data. EBADF The socket argument is not a valid file descriptor. ECONNRESET A connection was forcibly closed by a peer. EFAULT The buffer parameter can not be accessed or written. EINTR The recv() function was interrupted by a signal that was caught, before any data was available. EINVAL The MSG_OOB flag is set and no out-of-band data is available. ENOTCONN A receive is attempted on a connection-mode socket that is not connected. ENOTSOCK The socket argument does not refer to a socket. EOPNOTSUPP The specified flags are not supported for this socket type or protocol. ETIMEDOUT The connection timed out during connection establishment, or due to a transmission timeout on active connection. The recv() function may fail if: EIO An I/O error occurred while reading from or writing to the file system. ENOBUFS Insufficient resources were available in the system to perform the operation. ENOMEM Insufficient memory was available to fulfill the request. ENOSR There were insufficient STREAMS resources available for the operation to complete. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
poll(2), recvmsg(3XNET), recvfrom(3XNET), select(3C), send(3XNET), sendmsg(3XNET), sendto(3XNET), shutdown(3XNET), socket(3XNET), attributes(5), standards(5) SunOS 5.10 10 Jun 2002 recv(3XNET)
All times are GMT -4. The time now is 03:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy