This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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]

Problems with ppp and Windows


I've run out of food and drink. This will be my last note in my log :-)

- the problem is that accept() in the attached application does not wake
up until I kill the telnet process. I'm pretty confident that this app
is correct, because it works when I compile and runit from CygWin.
- Debugging TCP/IP is really difficult without an in depth knowledge of
TCP/IP and the freebsd stack. However, I believe that accept() should be
awoken by the invocation of soisconnected() from tcp_input.c since this
is what happens when I kill the windows telnet process. I don't know
what the significance, if any, it is that TCPOPT_CC is not received and
hence a "3 way handshake" is to be used instead. 
- As near as I can tell, Windows believes it is connected, because I
receive packets in my eCos application for the text I typed into the
telnet session before I kill the telnet process.
- I've submitted various patches lately in this regard, but nothing
earthshattering.


Attached: echo.c CygWin/Linux echo app. Same code gets stuck on accept()
w/PPP, Windows PPP server when running under eCos.

-- 

Øyvind Harboe
http://www.zylin.com


#include	<netdb.h>
#include	<netinet/in.h>
#include	<sys/types.h>
#include	<sys/socket.h>
#include	<stdio.h>
#include	<time.h>
#include	<signal.h>
#include	<string.h>


int main()
{
	int 	 sd, sd_current;
	struct   sockaddr_in sin;
	struct   sockaddr_in pin;
 
	/* get an internet domain socket */
	if ((sd = socket(AF_INET, SOCK_STREAM, 0)) != -1) 
	{
		/* complete the socket structure */
		memset(&sin, 0, sizeof(sin));
		sin.sin_family = AF_INET;
		sin.sin_addr.s_addr = INADDR_ANY;
		sin.sin_port = htons(23);

		/* bind the socket to the port number */
		if (bind(sd, (struct sockaddr *) &sin, sizeof(sin)) != -1) 
		{
			/* show that we are willing to listen */
			if (listen(sd, SOMAXCONN) != -1) 
			{
				/* wait for a client to talk to us */
			    socklen_t addrlen = sizeof(pin);
				if ((sd_current = accept(sd, (struct sockaddr *)  &pin, &addrlen)) != -1) 
				{
					for (;;)
					{
						/* get a message from the client */
						char dir[10];
						int len;
						len=recv(sd_current, dir, sizeof(dir), 0);
						if (len == -1) 
						{
							break;
						}
					
						/* acknowledge the message, reply w/ the file names */
						if (send(sd_current, dir, len, 0) != len) 
						{
							break;
						}
					}
		    	    /* close up both sockets */
					close(sd_current); 
				}
			}
		}
		close(sd);
	}
	return 0;
}


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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