TCP sockets - Connect-Disconnect-Reconnect

Hello,

I’ve been working with the Reach chips for some time now, integrating with C# based apps. I’ve worked out a Socket.Close() routine that rebuilds the socket so that it can be repopulated with the IP/port configuration and reconnected. I find that on the subsequent connects the data begins to stutter. I was receiving an error… unfortunately I don;t have the lines with me, but I was wondering a copule things in the immediate time and I’ll post the errors the next time I launch the connection:

Is there a way to send a signal to the source to formalize the socket close in a way that the Reach will accept? Is there a way for Reach to acknowledge a reconnect?

I’ll post the specifics soon. I’m actually about to take my lunch so I’ll probably run something when I get back.

Hi Sebastien,

Do you work with Reach configured as a TCP server or client? Overall, the server setting would be easier to program from the outside.

Hi Sebastian and Egor Im also trying to get TCP sockets to work with a C# app on my PC. I set Reach to Server and start the data output. It seems to automatically select localhost. But I just cannot see anything on my PC. I have tried every address and port imaginable. Could you tell me how you did it?

Best Wishes
Richard

Once your device is connected over TCP, you have to find its IP. localhost is just telling the device to “source from my location”. The port is like a cable channel.

Ensure your device is connected to your local wifi first, or connect directly to the device as the host.

Ok, I’ll try to explain what’s going on here.

When you configure Reach to output data to a TCP server it starts listening on a port you specified. It acts as a server, waiting for external connections. To access this data from your computer, you need to create a socket connection to Reach’s ip address and the port you specified.

When you configure Reach to output data to a TCP client another thing happens. You tell Reach the IP and port you want to send data to. Reach will continuously try and connect to this address and send data there. To receive this data, you should have a socket listening for incoming connection on that very address.