[En-Nut-Discussion] ----Program question----

Raul Valle rvl180 at hotmail.com
Sun Jul 30 08:15:39 CEST 2006


Hi all, I am doing this simple test and it compiles perfect, but, when runned it is making the connection but is not printing the "hello" on the screen and is not responding to the string i am sending from the pc , it is supposed to print "you type c" in the screen when i send "c".... any help would be appriciatd it




#include <cfg/os.h>
#include <string.h>
#include <stdio.h>
#include <io.h>
#include <dev/board.h>
#include <sys/version.h>
#include <sys/heap.h>
#include <sys/thread.h>
#include <sys/timer.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <pro/dhcp.h>

#ifdef NUTDEBUG
#include <sys/osdebug.h>
#include <net/netdebug.h>
#endif

#include <sys/confnet.h>
static u_char mac[]= {0x00,0x06,0x98,0x01,0x01,0x43};
static char buff[128];

int main(void)
{
TCPSOCKET *sock;
FILE *stream;
sock= NutTcpCreateSocket();


NutRegisterDevice(&devEth0,0x83,5);
NutNetIfConfig("eth0",mac,inet_addr("192.168.171.1"),inet_addr("255.255.255.0"));
if (NutTcpAccept(sock,23)==0)
{
for(;;){
fputs("Hello",stream);
fgets(buff, sizeof(buff), stream);
if (strncmp(buff,"c",sizeof(buff))==0){
fputs("you type c",stream);
}
else;
}
}
}


More information about the En-Nut-Discussion mailing list