10-18-2011
Quote:
Originally Posted by
andrew.paul
Hai every one ,,,
I am runinng one tcp socket in non-blocking mode. In the connect state(operation in progress) if the server is not running ,client socket select will give success.
FD_ISSET(socketfd,&wfd) will give me succes always and am getting wfd value as 16. I tried with blocking mode it is working fine .....
select() is there to tell you whether things will block or not, whic makes O_NONBLOCK rather redundant. Probably shouldn't use both.
10 More Discussions You Might Find Interesting
1. Programming
Excuse me . I'm a beginner . In windows , MFC can be used , but how to do in Unix ? And does unix support c++like VC++ ? How can I get developing tools in Unix ? (7 Replies)
Discussion started by: sanjohn
7 Replies
2. HP-UX
Our system is having a server and multiple clients. We are monitoring the client FDs using select() system call in HP-UX.
After establishing connection-using socket with the remote client, before start sending the data we are checking the status of socket using select( ) call. For first 16... (0 Replies)
Discussion started by: AshokG
0 Replies
3. UNIX for Advanced & Expert Users
Hello,
I need help to replace the ................. of client.c that request the server implemented by server.c
------------------
Listing 1 - server.c
/* Inclusion des différentes librairies nécessaires */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
... (0 Replies)
Discussion started by: bounkolh
0 Replies
4. UNIX for Dummies Questions & Answers
Hi all,
I'm writing a kernel module and part of it involves controlling IPCs between processes. My problem is when a process tries to connect to a Unix domain socket, the only identifying information of the socket it supplies (that I can see, anyway) is the special pathname of the socket. From... (0 Replies)
Discussion started by: blank87
0 Replies
5. UNIX for Dummies Questions & Answers
Sorry if this is a stupid question!
I have been developing a Java application that I am deploying on both Unix and Linux servers, which uses lots of socket handling. When the server side connection is dropped by the server un-gracefully I have been seeing close_waits and null connections.
... (0 Replies)
Discussion started by: Vinnie
0 Replies
6. UNIX for Advanced & Expert Users
Hi,
I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime.
To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies
7. IP Networking
hi
I am strucked in a client server program
client need to login to server
client logins if only username and password are correct
i have written a program
username is stored as file and password is smilar to username whic is stored in that file
when server asks for username... (2 Replies)
Discussion started by: karthik1238
2 Replies
8. UNIX for Advanced & Expert Users
Write a C socket program on UNIX where a TCP client sends/reads a
time in decimal 24 hours format to the server and the server echoes the
seconds, minutes, and hours in the time.
Example: Client sends 18.78 hours and the server displays 18 hours, 46
minutes and 48 seconds. (1 Reply)
Discussion started by: adi_always4u143
1 Replies
9. Programming
Hi all,
my name is anjali, working as an intern, doing masters
i have an assignment from my school, which i am not able to solve,
can someone please help me in finding the solution for this problem
thanking you in advance....lol
Write a C socket program on UNIX where a TCP client... (1 Reply)
Discussion started by: anjali.symantec
1 Replies
10. IP Networking
I need clarification on whether it is okay to set socket options on a listening socket
simultaneously when it is being used in an accept() call?
Following is the scenario:-
-- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies
socket(7) Miscellaneous Information Manual socket(7)
NAME
socket - interprocess communications
DESCRIPTION
Sockets are communication endpoints that allow processes to communicate either locally or remotely. They are accessed by means of a set of
system calls (see socket(2)).
The following requests are defined in (see ioctl(2)):
If the int with the address
arg is non-zero, the socket is put into non-blocking mode. Otherwise, the socket is put into blocking mode. Blocking mode
is the default. The request is equivalent to the request, although using is not recommended. See accept(2), connect(2),
recv(2), and send(2) for an explanation of how non-blocking mode is used.
For SOCK_STREAM sockets, the number of bytes currently readable from this socket is returned in the integer with the address
arg. For SOCK_DGRAM sockets, the number of bytes currently readable, plus the size of the sockaddr structure (defined in is
returned in the integer with the address arg.
For SOCK_STREAM TCP sockets, on return the integer with the address arg is non-zero if the inbound TCP stream has been read up
to where the out-of-band data byte starts. Otherwise, the inbound TCP stream has not yet been read up to where the out-of-
band data byte starts. For sockets other than SOCK_STREAM TCP sockets, on return the integer with the address arg is always
zero.
This request sets the process group or process
ID associated with the socket to be the value of the integer with the address arg. A process group or process ID associated
with the socket in this manner is signaled when the state of the socket changes: is delivered upon the receipt of out-of-
band data; is delivered if the socket is asynchronous, as described in below. If the value of the integer with the address
arg is positive, the signal is sent to the process whose process ID matches the value specified. If the value is negative,
the signal is sent to all the processes that have a process group equal to the absolute value of the value specified. If
the value is zero, no signal is sent to any process. It is necessary to issue this request with a non-zero integer value to
enable the signal delivery mechanism described above. The default for the process group or process ID value is zero.
This request returns the process group or process
ID associated with the socket in the integer with the address arg. See the explanation for above for more details on the
meaning of the integer value returned.
If the integer whose address is
arg is non-zero, this request sets the state of the socket as asynchronous. Otherwise, the socket is put into synchronous
mode (the default). Asynchronous mode enables the delivery of the signal when either of the following conditions is met.
o New data arrives.
o For connection-oriented protocols, whenever additional outgoing buffer space becomes available or the connection is
established or broken.
The process group or process ID associated with the socket must be non-zero in order for signals to be sent. The signal is
delivered according to the semantics of described above.
The fcntl(2) and flags (defined in are supported by sockets. If the flag is set, the socket is put into POSIX-style non-blocking mode. If
the flag is set, the socket is put into non-blocking mode. Otherwise, the socket is put into blocking mode. Blocking mode is the default.
See accept(2), connect(2), recv(2), and send(2) for an explanation of how these forms of non-blocking mode are used.
Since the and flags and requests are supported, the following clarifies on how these features interact. If the or flag has been set, and
requests behave accordingly, regardless of any requests. If neither the flag nor the flag has been set, requests control the the behavior
of and
DEPENDENCIES
AF_CCITT Only
Only the and requests are defined for sockets.
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSO
fcntl(2), getsockopt(2), ioctl(2), socket(2).
socket(7)