LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-09-2011, 10:13 AM   #1
jeriryan
Member
 
Registered: Apr 2003
Location: United States
Distribution: RHEL 5.4, Snow Leopard
Posts: 87

Rep: Reputation: 15
Default port for UDPWriter class


This is a really specific question, but maybe someone can help. I'm debugging someone else's code, and they call a UDPWriter and specify an IP address and port, and I'm trying to make sure this multicast traffic goes over a certain port. How can I determine which port the UDP defaults to and change it?

It's confusing to me because I'm not familiar with all the layers the OS sends traffic through before it goes through the interface.

Is there maybe some simpler way to tell the OS to send multicast traffic over both interfaces?
 
Old 05-10-2011, 04:07 AM   #2
baltho
Member
 
Registered: Aug 2004
Location: Adelaide, South Australia
Distribution: Ubuntu (Natty)
Posts: 38

Rep: Reputation: 18
Any UDP connect function call should include both an IP and a port number. Changing the port number should be as easy as tweaking the connect call. A "raw" UDP packet won't have a default port - it'll be specified in the code somewhere.

Which interface(s) are used happens at a lower level, though - the routing tables will determine which interface, if any, can best route your UDP packets to the desired destination. The port should make no difference to that part of the equation. To cover two interfaces, you'd probably need to send two multicast packets to the two subnets. (If I'm understanding your question correctly).

If you check out the OSI networking layers - http://en.wikipedia.org/wiki/OSI_model for instance - the interfaces are determined at level 3 (IPv4/6) and the UDP port at level 4. A good read for a network geek, that page!!
 
Old 05-10-2011, 04:12 AM   #3
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Port numbers range from 1 (maybe 0?) to 65535. The ones in the range of 1-1023 can only be used by a process running with root-privileges. Other ports have special meaning (Google for "ephemeral ports").

As for Multicasting, addresses are restricted to the following ranges: 224.0.0.0 to 239.255.255.255

Some of these addresses are reserved for Multicasting routing information. Applications should not use these reserved addresses, which are: 224.0.0.0 to 224.0.0.255

Armed with this information, can you please explain a little further what you mean by "port"? Are you referring to the port numbers described above, or the network interface (e.g. eth0, wlan0, lo, etc)?

And lastly, before I can suggest anything further, I would need to know which language your code is written in. Consider providing a snip of code where the UDPWriter object binds to the port/address.
 
  


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
[SOLVED] Python n00b: promoting a derived class to base class? CoderMan Programming 2 03-11-2010 01:46 PM
PLESK [Solution] Change port to 23 (telnet) instead of default port 8443 x5452 Linux - Software 6 05-10-2009 05:58 AM
C++ templated Node class: pointers to different instantated class types jhwilliams Programming 3 08-20-2007 06:20 PM
Does derivated class inherit base class destructor (constructor)? kornerr Programming 2 08-23-2006 08:05 AM
Which C++ editor in Linux has the class view/class browser feature imaginationworks Programming 7 05-21-2006 11:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:29 AM.

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