mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* is there a bug in kernel?
@ 2005-11-16  9:01 jywang
  0 siblings, 0 replies; only message in thread
From: jywang @ 2005-11-16  9:01 UTC (permalink / raw)
  To: linux-kernel

i program a server and a client using tcp.
the client send a string to the server, and the server send the string back
when it received it.
all is ok before i set a srr option in the socket.

the lines i used below:

 char opt[7]={131, 7, 4, 192, 168, 1, 1};
 if(setsockopt(socket_descriptor, SOL_IP, IP_OPTIONS, opt, 7)) printf("error
find in set options!\n");


when this lines are inserted into my program, all packets are ok except the
last packet send back
because i monitor the link using libpcap.

it seems the string back ok, but can't be received by my program. the client
is waiting and waiting and ...

why?

my client program as below:
-------------
 socket_descriptor = socket(AF_INET, SOCK_STREAM, 0)) ;
 char opt[7]={131, 7, 4, 192, 168, 1, 1};
 if(setsockopt(socket_descriptor, SOL_IP, IP_OPTIONS, opt, 7)) printf("error
find in set options!\n");
connect(socket_descriptor, (void *)&pin, sizeof(pin)) == -1);
send(socket_descriptor, str, strlen(str)+1,0) == -1 );
recv(socket_descriptor, buf, 8192, 0) == -1) ;
---------------

my server progarm as below:
--------------
  sock_descriptor = socket(AF_INET, SOCK_STREAM, 0);
  bind(sock_descriptor, (struct sockaddr *)&sin, sizeof(sin)) == -1) ;
  listen(sock_descriptor, 20) == -1) ;
  while(1) {
        temp_sock_descriptor = accept(sock_descriptor, (struct sockaddr
*)&pin, &address_size);
        read(temp_sock_descriptor, buf, 16384, 0) == -1) ;
        printf("\nReceived from client: %s\n", buf);
        write(temp_sock_descriptor, buf, strlen(buf), 0) == -1) ;
    }
--------------








^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-16  9:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-16  9:01 is there a bug in kernel? jywang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome