UDP source port number when using RAW socket??

This is a discussion on UDP source port number when using RAW socket?? within the Linux Networking forums, part of the Linux Forums category; Hello Everyone I have created an application that runs as a client on a ADSL modem and communicates with a ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-28-2004
Andreas
 
Posts: n/a
Default UDP source port number when using RAW socket??

Hello Everyone

I have created an application that runs as a client on a ADSL modem
and communicates with a server on a Windows/MAC using as RAW socket
with:
sk = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL));

With this socket I can send RAW data to the server that listens on
62828 . When I send I create my own ethernet, IP and UDP and send it
out on my eth0 interface. This all works fine and my server receives
the data correctly and responds. However now I have a question what
number to assign to my source port number on UDP when creating my
packet on the client??

From what I understand when using a UDP socket and having the network
stack creating the message the UDP source port number is taken from an
internal list. This ensures that no applications will select the same
port numbers when sending out data. But since I create my own packets
and send them out using RAW socket I can just give and number as UDP
source port number and I feel that this is not correct. If I am
unlucky I will create a conflict having 2 applications(my client) and
another one both sending out on the same port.

So my question is:
1) How do I get "hold" of a valid UDP port number that I can assign to
my RAW packet?
2) Is there some sort of API I can call and if so what?
3) What are the implications/problems if one for some reason have two
applications sending out data on the same port number?

Any input and advice is greatly appreciated.

Regards
Rikard
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:00 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0