02-04-2013 04:18 AM
Hi,
I am creating a TCP listener in one of the client PC, After sometime I get TCP error 66 from the TCP listener, and in that case I am trying to re-create the listener with the same socket number but its always timed out and I never get an active connection.
So, can anyone suggest that if the TCP connection is opened in server and the listener loses the connection in the client, for getting an active listener, do I need to close and open the server TCP connection again ?
02-04-2013 10:25 AM
It would be very helpdful if you could post your code.
02-05-2013 04:41 AM
Hi Mark,
Its not possible to post the code. First thing I want to know is
> If TCP listener loses a connection, then is it possible to regain it without closing the TCP Open connection.
02-05-2013 09:38 AM
@RJ_15 wrote:
Hi Mark,
Its not possible to post the code. First thing I want to know is
> If TCP listener loses a connection, then is it possible to regain it without closing the TCP Open connection.
No, once a connection is lost you need to reestablish a new connection.
You could post a simplified verion of your client/server so we can see how you are managing things. It is really difficult to give advice or identify problesm with code without seeing it.
02-05-2013 03:20 PM
At least to me it's not clear at all what you are trying to do, and I'm sure I'm not the only one, so some sample code showing your problem really would go a long way into helping yourself.
For one thing the TCP Listen doesn't maintain a connection at all but simply opens a socket to receive a connection and hands it back to your code to do whatever you want to do on that connection. As such TCP Listen can not really "loose" a connection with a timeout error. So either you have a timeout on the TCP Listen and the listen timeouts waiting for a connection to arrive, or you use TCP Read and/or Write to do something on the connection and get the timeout error there.
02-28-2013 07:59 AM - edited 02-28-2013 07:59 AM
Here is the attached Sample VIs.
The Server VI is opening the TCP connection and the Client VI is creating a listener to it.
The problem is, if any TCP error comes in Client VI, after closing the connection I am trying to listen to the same port again. But its not able to create an active listener again.
Hope this makes sense.
Runjhun
02-28-2013 09:32 AM
First, your termanology is incorrect. In networking servers are the process that listen for connections and clients are processes that connect to a server. You are reversing the roles of your processes.
As for your specific questions you are not doing any error processing which will have the server (what you are calling the client) go back into a listening state for a new connection. Here is some basic code which demonstrates a server which will handle a single connection but will go back and wait for a new connection if the client disconnects or the connection is lost. It also demonstrates some very basic data transfer between the two processes.