[En-Nut-Discussion] TCP server

Valentin Dodov valdodov at gmail.com
Tue Jul 19 07:46:20 CEST 2011


Hi Harald,

I already understood that nothing is wrong with my program.

I'm using null_ether (someone should read it's code :) ) and it sends
outgoing packets to noting - so there is no reply from the server.

Thank you for your prompt reply.

Best regards,

Valentin Dodov


On Mon, 2011-07-18 at 17:09 +0200, Harald Kipp wrote:

> Hi Valentin,
> 
> On 7/18/2011 1:41 PM, Valentin Dodov wrote:
> > I'm trying to create and test simple TCP server.
> 
> You do know
> 
> http://www.ethernut.de/nutwiki/Basic_TCP_Server
> http://www.ethernut.de/nutwiki/Basic_TCP_Client
> 
> right?
> 
> 
> > My program starts one thread which listens for incoming connections on
> > port 21 and one thread which connects to port 21.
> > 
> > When second thread tries to creates socket there are 2 sockets and the
> > first one is allays in  SYNSENT state:
> 
> I'm confused. According to the first sentence, the first socket is a
> server socket, which should never get into SYN_SENT.
> 
> Client sockets will get into SYN_SENT state, if there is no response
> from the server. This state may last a quite long time until
> NutTcpConnect() finally gives up and returns an error. I'd recommend to
> further analyze this with
> 
> http://www.wireshark.org/
> 
> Also check
> 
> http://en.wikipedia.org/wiki/SYN_%28TCP%29#Connection_establishment
> 
> > This is my code:
> >         NutTcpAccept (sock, 21);
> >         puts ("Client connected\n");
> >         stream = _fdopen((int) sock, "r+w");
> >         fclose (stream);
> >         NutTcpCloseSocket (sock);
> >         printf ("Client disonnected\n");
> 
> Isn't there some input missing. The server socket will immediately
> closing the socket as soon as a connection is established. Do you want
> this? Isn't there an fgets or similar missing?
> 
> 
> Regards,
> 
> Harald
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion





More information about the En-Nut-Discussion mailing list