|
Hi, I am trying to figure out some basic sockets programming using Scott Klement's tutorial. This is an excellent tutorial! Here is the problem I am finding. I use the code from Scott's sample: C************************************************* C* Create a socket address structure that C* describes the host & port we wanted to C* connect to C************************************************* c eval addrlen = %size(sockaddr) c alloc addrlen p_connto c eval p_sockaddr = p_connto c eval sin_family = AF_INET c eval sin_addr = IP c eval sin_port = port c eval sin_zero = *ALLx'00' C************************************************* C* Connect to the requested host C************************************************* C if connect(sock: p_connto: addrlen) < 0 c eval msg = 'unable to connect to server!' c dsply msg c callp close(sock) c return c endif and it works fine. The problem is that it shouldn't work because I do not actually have a socket server listening on the port I specify in the SIN_PORT paramater. That is, if I use a port # of 8540 in SIN_PORT for example but my socket server is actually listening on port 3994, then I should get an error, right? But I don't. Instead, I get the return value = 0 and the program continues on. If it makes a difference, my socket server is running on a pc and I use the DOS command NETSTAT -a to see what is active on all the ports. I see my socket server listening on port 3994 and nothing on 8540, and yet the connect does not return a negative value. Obviously I am missing something here, but I am so new at this stuff that I cannot see what it is. Anyone have any ideas of things I could check? Thank You Dave Johnson --------------------------------- Yahoo! Mail - Helps protect you from nasty viruses.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.