Error on reconnecting to TCP port


I’ve created a simple application in GRC using a TCP source in server
When started, it excepts connections on the allocated port for the first
However, after statefully disconnecting from the port, any further
attempts to
make a new connection with the server application fail - “connection
Is this the expected behavior? I was assuming that it will accept new
connections after disconnecting from the previous session.

cheerio Berndt

Yes, definitely expected because of the way things are implemented:

The server block waits on listen, and passes the file descriptor to the
first connection to the gnuradio file descriptor source/sink. After that
there is no way for it to accept another connection and replace the file
descriptor block.

To do this in a better way, we would probably need a more complicated
tcp block, or something at the C++ level.


On Sun, Apr 25, 2010 at 09:52:05PM -0700, Josh B. wrote:


connections after disconnecting from the previous session.

cheerio Berndt

This stuff is easy to do Python.

Have python set up the listener, then call accept when somebody
connects. Then either hand off the socket/file descriptor to a
gr_file_descriptor_{sink,source}, or do some dup2 magic to shuffle the
file descriptors around so that the file descriptor that a
gr_file_descriptor_{sink,source} already has open now refers the
socket that you’re interested in.

Google for standard BSD socket examples.