1

I'm trying to establish a connection using sockets between 2 PC's on the same LAN using the Eiffel Programming Language. I'm trying to run the examples that are by default on the installation directory of Eiffel Studio. However right now I'm trying to make it on the same machine by addressing to localhost (127.0.0.1).

It works perfectly on Linux (Ubuntu 15.10) but on windows 7 I'm getting an exception when I try to run the client program. The code of the exception is 24 Unable to establish connection. The server program runs just fine and I already got a connection between a client on linux and a server on windows. I didn't find a solution to this exception on the documentation nor on other sites. Here is a screencap:

Screencap of the debugger

Here is a link to the doc:

https://www.eiffel.org/doc/solutions/Two%20Machines

Thank you in advance.

  • Do you run both a client and a server in Windows or do you run one of them in a virtual machine? I've just checked that if both run on Windows (same machine), there is no issue. However I remember that when running a virtual machine there could be issues with port numbers: they are not automatically freed and sometimes a complete restart is required to free them. – Alexander Kogtenkov Apr 27 '16 at 16:27
  • Yes, I tried it on the same machine. Not in a virtual machine. Could you tell me which ports did you use to get it to work on the same one? – Juan Pablo Mendez Nogales Apr 28 '16 at 15:26
  • The port number was 55555. – Alexander Kogtenkov Apr 29 '16 at 08:16
  • The problem was the port number. I tried 30 before and it didn't work, but with 55555 it works without a problem. Thank you! I assume Windows block certain port numbers and then the program crashes trying to open them. – Juan Pablo Mendez Nogales Apr 29 '16 at 16:08
  • I'll add an answer then, so that the question can be considered closed. – Alexander Kogtenkov May 01 '16 at 07:45

1 Answers1

0

The issue might be caused by the fact that some ports are used and others are reserved by the system. In particular the port range 0-1023 is designated for use by common system and network services. Ports beyond this range can also be registered (e.g., Service Name and Transport Protocol Port Number Registry or List of TCP and UDP port numbers). System security settings could also prevent applications from using specific port numbers.

The solution is to look for and to use port numbers that are available for user applications. Ports currently used on Windows can be found with netstat -an, what can be used is related to TCP/IP and firewall settings. The simplest approach is to try using some other port numbers, e.g. in the range 1024-49151.

Alexander Kogtenkov
  • 5,770
  • 1
  • 27
  • 35