Re: UDP source port number when using RAW socket??

From: Steve Watt (steve_at_nospam.Watt.COM)
Date: 06/29/04

  • Next message: Joe Seigh: "Re: Program crashes - debugging suggestions?"
    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...
    

  • Next message: Joe Seigh: "Re: Program crashes - debugging suggestions?"

    Relevant Pages

    • RE: Some technical errors
      ... If the SMTP server is not running on port 25 TCP it is not a public ... Manager - Computer Assurance Services BDO Chartered Accountants & ...
      (Security-Basics)
    • Re: SRV RRs support in Internet Explorer?
      ... The port number could be implicit (i.e. ... At any point in time, a server could fail ... can't effectively LB or backup because NSs cache the records for the TTL ... I still don't see how SRV records would help backup or LB. ...
      (microsoft.public.win2000.dns)
    • Re: Still cant connect to RWW or OWA remotely
      ... I get 'cannot find server or dns error' on both ... TCP [port number]> to open the ports. ... As for error messages when I fail to access RWW with the laptop, ... network, no connection seems possible. ...
      (microsoft.public.windows.server.sbs)
    • Re: cannot send mail from Windows mail
      ... When a username/password combination doesn't work in Windows Mail, ... I mean I dont use it but as outgoing address for my ISP account. ... youir username and password are correct for your mail server". ... Ask your home ISP if they support SMTP on a port other than 25. ...
      (microsoft.public.windows.vista.mail)
    • Re: How to trigger server to reattempt printer connection
      ... The spooler does not log any SNMP data. ... Best practices and known issues when you install Windows Server 2003 Service ... Before restarting the spooler next time, create a new port name to the ... This does not happen often, but when it does, it seems to stay offline ...
      (microsoft.public.windows.server.general)