Thread View: borland.public.cppbuilder.internet.socket
2 messages
2 total messages
Started by didier
Thu, 01 Jun 2006 12:29
a Client connection without Server accept() : possible ?
Author: didier
Date: Thu, 01 Jun 2006 12:29
Date: Thu, 01 Jun 2006 12:29
35 lines
2027 bytes
2027 bytes
Hello everybody, As guys here seem smart, is there any explanation to this fact : 1- I launch a TCP server (socket(AF_INET, SOCK_STREAM, 0) + bind + listen) and break my prog immediately AFTER completion of listen(). So, the server is stopped here and shall NEVER accept() any connection. NOTA : the server is programmed with VisualC++2005 (8.0) 2- I launch a TCP client (socket) NOTA : the client is programmed with Borland C++ 6.0 with the VCL Lib (ClientSocket). 3- I press a button which sets the ClientSocket->Active flag to "true". This is the only thing I do with this VCL component to connect a client to a server (as far as I know). RESULT : The client tells that the connection has been successfully established with the server. I verify this with the flag ClientSocket->Socket->Connected = true ! The weird thing is that the server is breaked : which mechanism has accepted the client socket connection ? Not the server ! I cannot find any explanation. It changes my view of the listen function : it does not work as I believe... I thought that only the accept() function validates the client connection request... Any idea of test(s) to understand this behavior ? Thanks. didier
Re: a Client connection without Server accept() : possible ?
Author: Remy Lebeau (TeamB)
Date: Thu, 01 Jun 2006 17:44
Date: Thu, 01 Jun 2006 17:44
25 lines
2044 bytes
2044 bytes
"didier" <jehanno@lal.in2p3.fr> wrote in message news:447eddb9$1@newsgroups.borland.com... > RESULT : The client tells that the connection has been > successfully established with the server. I verify this with > the flag ClientSocket->Socket->Connected = true ! The Connected property is set to true as soon as the WinSock API connect() function completes its work. > I cannot find any explanation. It changes my view of the listen > function : it does not work as I believe... I thought that only > the accept() function validates the client connection request... accept() provides a SOCKET handle to the server code to access the connection. The only explanation for what you see is that the connection itself has been established when it is placed in the server socket's queue that was created by listen(). The server socket knows the connection it there, it just hasn't retreived it from the queue yet. In the meantime, listen() returned a response back to the client to let it know that the connection was acknowledged. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads