AW: [En-Nut-Discussion] ----Program question----
Ernst Stippl
ernst at stippl.org
Sun Jul 30 08:35:27 CEST 2006
Hi again!
Have a look at tcps.c in the samples. you are (at least) missing
if ((stream = _fdopen((int) sock, "r+b")) != 0) {
to bind the stream to the socket.
regards
ernst
-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Raul Valle
Gesendet: Sonntag, 30. Juli 2006 08:16
An: en-nut-discussion at egnite.de
Betreff: [En-Nut-Discussion] ----Program question----
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;
}
}
}
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.5/403 - Release Date: 28.07.2006
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.5/403 - Release Date: 28.07.2006
More information about the En-Nut-Discussion
mailing list