From: "jywang" <jywang@cnic.cn>
To: <linux-kernel@vger.kernel.org>
Subject: is there a bug in kernel?
Date: Wed, 16 Nov 2005 17:01:01 +0800 [thread overview]
Message-ID: <014a01c5ea8c$44788fc0$060ae29f@javaboy> (raw)
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) ;
}
--------------
reply other threads:[~2005-11-16 9:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='014a01c5ea8c$44788fc0$060ae29f@javaboy' \
--to=jywang@cnic.cn \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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