ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello all,
I am right now working on an application which makes use of 3 sockets and all these 3 sockets are udp sockets. Initially when i start executing the application one socket will be opened and a thread will begin to do a select on the socket to receive any messages from the server. Next when i issue a particular command the other two sockets would become active and those will also have a thread which does a select on both of them. Now comes the problem the messages which are sent to these two latter sockets are not being captured. To check the status of my ports i did a nmap and this is how it came out
PORT STATE SERVICE
111/udp open|filtered rpcbind
631/udp open|filtered unknown
701/udp open|filtered unknown
5353/udp open|filtered unknown
8000/udp open|filtered unknown ->opened when i execute a particular command
8001/udp open|filtered unknown ->opened when i execute a particular command
32768/udp open|filtered omad
36000/udp open|filtered unknown -> opened when i start execution
The open|filtered state means that nmap has not received any response from those ports.
The funniest part of the issue is this . When i do the nmap , at that particular instance alone the messages are received on those two sockets. I beleive that nmap must be sending NULL UDP packets to all the ports which we specify on a range to check the status. But otherwise iam not able to receive any messages in both the sockets. The issue is wierd and iam not able to find any solution for this issue. If anyone knows a way in which the issue cud be solved please let me know.
Hi Mara,
Thanks for ur reply. I was able to fix this issue with changing the firewall settings on my FC4 machine. I actually disabled my fire wall and then the messages on those two sockets were received by my application successfully. This still is confusing , then how come the udp messages on the first port alone are received properly. As far as my socket code is concern there are no issues cos for every single operation on the socket an error check is done and all three sockets are created with the same properties . The 3 sockets created are non blocking sockets.
If you do nmap from the same machine, connections go via loopback interface, which is usually covered by a different set of iptables rules. That might be the cause.
Hi Mara,
There is one more thing i need to ask u. If the fire wall is disabled is there a chance that the incoming udp packet may be corrupted. Cos as i said u previously. When i do the nmap i am able to receive the udp packets and there is no problems. When i disabled the fire wall and then the packet which came in actually crashed my application . I suspect a corruption in the udp packet. Is that a likely event???
"Corruption" of the UDP packet is possible with nmap and a firewall lets you filter strange packets. I suspect there's a problem with the application. It'll be easier if you post the part of the code that's behaving that way.
Hi,
Thanks for ur reply. The socket programming module of my application does work properly . The issue is that even when i try to write the message received into file opened in write binary mode , the fwrite shows that it has written the exact number of bytes that the recvfrom() call has returned. the problem is when i try to open the file using hexedit , there is no content in that file. But this is the same message which seems to cause a crash in my application . This message is basically an RTCP message sent as a udp packet . Even junk if any must be written into a file right???? . This iam not able to perform. I cannot post my code its against my organization rules.
Hi ,
I have found out the issue . The issue is not with the socket code. The socket code works perfectly. The issue is a memory corruption in a different layer. There is no problem with the udp packets which come in , no chance of corruption or anything. The memory corruption happens in a different place. Thanks very much for ur support and help in solving the issue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.