This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Winsock


On 07 December 2006 19:21, Lucas Charron wrote:

> I can connect to my listening socket from within the
> same process and transmit data to and from the "server" and "client",
> but, if I try to use a web-browser, I get "This connection was denied"
> and the server application has no notification of anything even trying
> to connect. I've checked all of windows' firewall settings (firewall is
> disabled). I've also tryed binding to my external IP and to my loopback.
> I've tryed binding to "0.0.0.0". Somewhere, my connection is being
> rejected. I've checked the windows log files for dropped packets, and
> nothing. I'm at my wits end.
> All sockets functions return normally, there are no errors that windows
> is reporting. This is either a Windows or Cygwin problem, but I can't
> figure it out.

  There is no such thing as a per-process socket, so that can't be the cause
directly.  I suggest you a) look at the netstat output to make sure that the
socket you think is there and listening is valid and b) try to connect with
something simple like telnet or netcat rather than a browser.

  The most likely explanation for this behaviour is that you've got the wrong
endianness somewhere in your code when you setup the inetaddrs.  Within the
same process, you've got the same code, so the server is listening on
whichever numbered port you get if you byteswap (unsigned short)80, and the
client that tries to connect tries to connect to that port, whereas when you
try it with a real browser it tries to get to the real port 80 and finds
nothing there listening.  You must use htonX when entering values directly
into an inetaddr.




    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]