I need to write C code in Linux to send 10 Packets and each packet size of 200 bytes at a time to the TCP server on PPP Link, it is working fine on eth0 interface. the only problem when packets were sent with ppp interface.
i tried all the setsockopt options like TCP_MAXSEG , TCP_NODELAY, SO_SNDBUF none of them worked.
the requirement is i should use connect() system call once only.
and send the 10 packets in a loop using send() system call i tried like.
connect();
for(i=0;i<10;i++) {
send(fd,buf,sizeof(buf),MS
// sleep(1); if sleep is added it working fine.
}
if sleep is added it is working finethe idea is to avoid sleep.
does the send system call is blocked till the data is sent or any system cal to flush the data on tcp socket
to send immediately.
Main Topics
Browse All Topics





by: nociPosted on 2009-10-22 at 07:06:58ID: 25634347
There is no problem, a TCP link is just a stream of bytes, with no fixed borders. It can be intersected at any place and a router is allowed to split or join packets at some place if needed. It's too much work for a plain router, but a proxy might very well do this.
So you need to write code that will just read up to 200 bytes at a time and return that to the above application.