Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TClientSocket

Status
Not open for further replies.

sOlsTiCezA

Programmer
Mar 20, 2002
17
ZA
When using a TClientSocket on an NT machine, i get a 10049 error. The socket connects to the server, if the server is on the local machine using localhost. If i type in the IP address i.e 198.162.1.49 then i get that error. The program works on Windows 2000 and 98. Why won't it work on the NT machine. Any Suggestions?

Thanks
 
Straight from the WIN32 Sockets 2 Reference Guide:

WSAEADDRNOTAVAIL

(10049)


Cannot assign requested address.

The requested address is not valid in its context. Normally results from an attempt to bind to an address that is not valid for the local machine, or connect/sendto an address or port that is not valid for a remote machine (e.g. port 0). Cyprus
 
I am having the same problem, but with different OS. The client connects fine when running on Windows XP, but I get a WSAEADDRNOTAVAIL error code when running on Windows 98, both machines in the same network, connecting in the same adress:port. I have checked the Winsock help, searched in goggle for this error code and I found nothing who could really help me to solve this problem. Anyone have any solution/tip for me?
Fernando M.
Brazil

 
Cut and paste from my favourite error reference but I don't know if it's too low level for a TClientSocket. A quick programmatic check may be handy using the tip given in the last sentence.

" WSAEADDRNOTAVAIL (10049) Cannot assign requested address.

Berkeley description: Normally results from an attempt to create a socket with an address not on this machine.

WinSock description: Partly the same as Berkeley. The "address" it refers to is the remote socket name (protocol, port and address). This error occurs when the sin_port value is zero in a sockaddr_in structure for connect() or sendto().

In Berkeley, this error also occurs when you are trying to name the local socket (assign local address and port number) with bind(), but Windows Sockets doesn't ascribe this error to bind(), for some unknown reason.

Developer suggestions: Assume bind() will fail with this error. Let the network system assign the default local IP address by referencing INADDR_ANY in the sin_addr field of a sockaddr_in structure input to bind(). Alternately, you can get the local IP address by calling gethostname() followed by gethostbyname(). "



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top