Re: UDP source port number when using RAW socket??
From: Steve Watt (steve_at_nospam.Watt.COM)
Date: 06/29/04
- Previous message: OferH: "Re: hung pthread_cond_timedwait on uCLinux with v2linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Jun 2004 22:41:03 GMT
In article <f4178085.0406280235.6cd596d5@posting.google.com>,
Andreas <andreas_lindell76@hotmail.com> wrote:
>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??
Why are you bothering with raw packets if you're redoing all of the
work that the IP and UDP code does?
>So my question is:
>1) How do I get "hold" of a valid UDP port number that I can assign to
>my RAW packet?
Maintain the same list, like the UDP code does.
>2) Is there some sort of API I can call and if so what?
Probably not.
>3) What are the implications/problems if one for some reason have two
>applications sending out data on the same port number?
Depends on the protocol. If the other end uses the port you're sending
from as a place to send its data, you'll have to figure out how to
differentiate the two types of traffic. If the remote has a hardcoded
port that it sends to, then it doesn't matter what source port you
use.
-- Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.8" / 37N 20' 14.9" Internet: steve @ Watt.COM Whois: SW32 Free time? There's no such thing. It just comes in varying prices...
- Previous message: OferH: "Re: hung pthread_cond_timedwait on uCLinux with v2linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|