Re: Widnows sending RST in tpc/ip connection
- From: "Dave Lowther" <davel@xxxxxxxxx>
- Date: Wed, 23 Nov 2005 13:28:06 -0000
"Niklas Olsson" wrote in message
>
> Thank you for the suggestions,
> however I can't get it to work, but maybe I'm doing it wrong.
> I used
> Socket = socket (AF_INET, SOCK_STREAM, 0):
> and then
> local_sin.sin_family = AF_INET;
> local_sin.sin_port = htons (nPort);
> local_sin.sin_addr.s_addr = htonl (INADDR_ANY);
> bind (Socket, (struct sockaddr *) &local_sin,
> sizeof (local_sin)
>
> I thought that this might be enough, but is it?
> I tried also to call listen() after bind but I always end up with windows
> (or some program other than mine) sending the reset message.
> Since everything works find if I let winsock connect, there must be
> something I don't do correctly.
> (my SYN message seem to be working fine (I get back the SYN,ACK) and in
> comparassion to the SYN winsock send I can't find any differencies except
> checksum)
> I don't have any firewall running that would block.
Is your code a TCP/IP client, or server ?
Probably not necessary but I usually memset() the struct sockaddr with all
0's before filling out the required fields.
If it's a client:
o You shouldn't be setting the port number for bind, in fact why call bind
at all.
o You should be calling connect()
If it's a server:
o You should call socket(), bind(), listen(), accept()
o You should be setting the port number with bind
o You should use the socket returned by accept() to talk to the client.
HTH
Dave.
.
- Follow-Ups:
- Re: Widnows sending RST in tpc/ip connection
- From: Niklas Olsson
- Re: Widnows sending RST in tpc/ip connection
- References:
- Widnows sending RST in tpc/ip connection
- From: Niklas Olsson
- Re: Widnows sending RST in tpc/ip connection
- From: Niklas Olsson
- Widnows sending RST in tpc/ip connection
- Prev by Date: Re: Widnows sending RST in tpc/ip connection
- Next by Date: Re: Widnows sending RST in tpc/ip connection
- Previous by thread: Re: Widnows sending RST in tpc/ip connection
- Next by thread: Re: Widnows sending RST in tpc/ip connection
- Index(es):
Relevant Pages
|
Loading