Listening to Multiple Ports in c

Discussion in 'C' started by iwant2learn, Jul 4, 2011.

  1. iwant2learn

    iwant2learn New Member

    Joined:
    Jul 4, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    Can some one help me or guide me on how to access two different ports on a same multicast address.

    Assume that a server sends a mpeg2ts encapsulated using udp to a multicast group address say 239.0.0.1. It sends two streams to the same multicast address but to different ports say 1300 and 1400.

    In my program i have to access these to ports at a time. Is this possible???

    Please Help me with this

    Thank u
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    I don't know for certain cos I've never tried it. But I can't see any reason why the example given at http://www.alhem.net/project/example9/index.html can't be extended as follows:
    Code:
    	UdpTestSocket s1(h), s2(h);
    	port_t port1 = 1300, port2=1400;
    
    	s1.Bind(port1, 10);
    	s2.Bind(port2, 10);
    
    The only thing that could go wrong with this - aside from it not being supported - is that you might need two SocketHandlers:
    Code:
    	SocketHandler h1,h2;
    	UdpTestSocket s1(h1), s2(h2);
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice