LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-13-2012, 01:44 AM   #1
bmahjoor
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Rep: Reputation: Disabled
UDP Send/Receive problem on the same port


Hi,
I have a packet generator connected to my MAC that sends 100 UDP packets to my port 3000(It uses port 4000 to send these packets). I have a loop that receives these packets (recvfrom(..)) and send them back immdeiately, untouched and count them. However, these packets gets to my MAC and all the way up the stack (netdev->stats.rx_packets = 100). But my recvfrom(..) only receives 63 of these and sendto(..) is called 63 times. However, the packet generator receives only 3 packets at all time. Any suggestions as to what might be happening here ? What happened to the missing 37 packets ? And why nedev->stat.tx_packets does not agree with how many times sendto() has been successfully called ? I doubt if it is prohibited to send and receive using the same socket bounded to my receive UDP port...is it ? Should I use two different sockets and bind them to two different port, one for receive and one for send ?
Thanks in advance for any suggestions.
 
Old 03-13-2012, 10:04 AM   #2
eeekster
Member
 
Registered: Sep 2011
Posts: 163

Rep: Reputation: Disabled
Are you checking for errors being returned from the sendto() call?
 
Old 03-13-2012, 12:38 PM   #3
bmahjoor
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Of course. sendto() always returns the exact number of bytes given to it to send. Today I am delving into the kernel and check the transmit routine..it should be called at least as many times as my sendto() is called.
 
Old 03-13-2012, 12:48 PM   #4
eeekster
Member
 
Registered: Sep 2011
Posts: 163

Rep: Reputation: Disabled
Are you sure you aren't over running the receive buffers and dropping packets?
 
Old 03-13-2012, 04:37 PM   #5
bmahjoor
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
No, that's not the problem at all. The weird thing is sendto(..) is called and returns 63 times but the MAC driver's
transmit routine in kernel is only called 3 times. Have no idea what happened to the rest of the packets. I thought
sendto() returns only when the packet is passed to transmit routine.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl: UDP server receive / send packet to host superm@n Programming 2 04-02-2010 07:22 AM
Send a UDP Syslog packet with Source Port set to 514 fjkum Programming 1 01-26-2010 03:53 PM
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 10:40 PM
Modem Data Send/Receive Problem mofargel Linux - Hardware 1 10-16-2007 08:42 PM
How to receive UDP and ICMP packets, by one UDP socket(PMTUD) myself_rajat Linux - Networking 0 05-28-2004 05:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration