I would like to exchange date between to computers. So I provide one TCPSocket.listen and the second with TCPSocket.connect. Both on the same non reserved Port.
The first (Listening) connects. The event fires and the “IsConnected-Property” shows true. BUT
The second (Connect) gets the RemoteAddress from the “Listener”, but never changes into connected=true. No last error code. AND the Port-Property was altered in something completely different. Of course i never can start writing date because they never disappear from the buffer.
Can somebody please show me which screws to turn to make it work?
[quote=207920:@Bernhard Brämswig]I would like to exchange date between to computers. So I provide one TCPSocket.listen and the second with TCPSocket.connect. Both on the same non reserved Port.
The first (Listening) connects. The event fires and the “IsConnected-Property” shows true. BUT
The second (Connect) gets the RemoteAddress from the “Listener”, but never changes into connected=true. No last error code. AND the Port-Property was altered in something completely different. Of course i never can start writing date because they never disappear from the buffer.
Can somebody please show me which screws to turn to make it work?[/quote]
Have you tried the SynchronousTCPSocketClass and SynchronousTCPSocketExample projects in Examples/Communication ? It looks as what you are after.
Before connecting, TCPSocket.Port refers to the remote port which will be connected to; after connecting TCPSocket.Port refers to the semi-random local port being used for the connection.
ServerSocket is something I did not (yet) try.
Concerning the random chosen port:
I normally use the port to sneak trough the firewall of my Router. What if the response from the remote client returns a different way and finds the random port locked? Is the only way to put the serving computer into DMZ?
[quote=208375:@Bernhard Brämswig]ServerSocket is something I did not (yet) try.
Concerning the random chosen port:
I normally use the port to sneak trough the firewall of my Router. What if the response from the remote client returns a different way and finds the random port locked? Is the only way to put the serving computer into DMZ?[/quote]
Typically this isn’t a problem. Firewalls are usually smart enough to know the difference between new traffic (which is what it blocks) and established or related traffic (which is this port shifted traffic). It’ll probably work just fine.
Do not worry about the port changing. That is normal and will not be a problem with your firewall. Focus on everything else and forget the changed port. It actually means the connection was successful.