Home > other >  Delphi 11 TClientSocket can't connect to localhost, Windows socket error : 10049
Delphi 11 TClientSocket can't connect to localhost, Windows socket error : 10049

Time:09-16

So i did this tutorial exactly the same and im getting the Windows socket error: 10049. This is the tutiroal: https://docwiki.embarcadero.com/CodeExamples/Sydney/en/Chat_Room_Socket_(Delphi) What is the problem here?

CodePudding user response:

The problem you are facing here is that you are stil using port 0 (default values for both TClientSocket and TServerSocket components).

You should change the port number of both client and server component to be something else than 0. I recommend using ports greater than 1024 in order to avoid using reserved ports.

In fact you might want to consider checking IANA Service Name and Transport Protocol Port Number Registry to make sure the port you will be using isn't registered to another application or service.

PS: Embarcadero should have provided information about the need to change port number used in their example.

  • Related