UDP Packet Basic

Now i'm doing socket programming using UDP and TCP/IP and now again i
need your help.
1. Can UDP packet in Java put into data structure like C? or packet map to a java object but sender is not using Java program or serialize object.
2. What is the easiest way to extract the UDP packet in Java?
assume the structure like this.
sampleMessageHeader
MessageCode UInt 16
TimeStamp UInt 32
Message Char(12)

1. Serialisation - no problem. However, if the other end doesn't have a Java serialisation library (i.e. isn't using Java) then you'll have to serialise manually. (Well - it may be possible to find documentation on the serialisation format and strip the headers before you put the bytes into a UDP packet, but such a mechanism would be a mess and a headache).
2. packet.getData() gives you a byte[]. Wrap a ByteArrayInputStream round it, and a DataInputStream around that. Then assuming appropriate byte-ordering you'll be able to read ints and shorts. Of course, Java doesn't have a UInt type, and the meaning of Char depends on your C header files.

Similar Messages

  • JMF How to stream rtp from udp packet

    I implemented an rtsp client and use the client to setup two rtp session(audio, vedio). But when I use the example pramgram "AVReceive3" to stream the udp packet, it doesn't work.
    When the AVReceive3 receive the udp packet from the rtp port, it will call the update(ReceiveStreamEvent evt) function, and the event type is StreamMappedEvent, and the call to evt.getReceiveStream().getDataSource() return null.
    I thought the first event should be NewReceiveStreamEvent. Please help to solve the problem.
    What's rtp packet will cause the event StreamMappedEvent.
    Following is the code of AVReceive3.java:
    * AVReceive3.java
    * Created on 2007年10月30日, 下午4:11
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package PlayerTest;
    import java.io.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.media.*;
    import javax.media.rtp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.AudioFormat;
    import javax.media.format.VideoFormat;
    import javax.media.Format;
    import javax.media.format.FormatChangeEvent;
    import javax.media.control.BufferControl;
    * AVReceive3 to receive RTP transmission using the RTPConnector.
    public class AVReceive3 extends Thread implements ReceiveStreamListener, SessionListener,
    ControllerListener
    String sessions[] = null;
    RTPManager mgrs[] = null;
    Vector playerWindows = null;
    boolean dataReceived = false;
    Object dataSync = new Object();
    public AVReceive3(String sessions[])
    this.sessions = sessions;
    public void run()
    initialize();
    public boolean initialize() {
    try {
    mgrs = new RTPManager[sessions.length];
    playerWindows = new Vector();
    SessionLabel session;
    // Open the RTP sessions.
    for (int i = 0; i < sessions.length; i++) {
    // Parse the session addresses.
    try {
    session = new SessionLabel(sessions);
    } catch (IllegalArgumentException e) {
    System.err.println("Failed to parse the session address given: " + sessions[i]);
    return false;
    System.err.println(" - Open RTP session for: addr: " + session.addr + " port: " + session.port + " ttl: " + session.ttl);
    mgrs[i] = (RTPManager) RTPManager.newInstance();
    mgrs[i].addSessionListener(this);
    mgrs[i].addReceiveStreamListener(this);
    // Initialize the RTPManager with the RTPSocketAdapter
    mgrs[i].initialize(new RTPSocketAdapter(
    InetAddress.getByName(session.addr),
    session.port, session.ttl));
    // You can try out some other buffer size to see
    // if you can get better smoothness.
    BufferControl bc = (BufferControl)mgrs[i].getControl("javax.media.control.BufferControl");
    if (bc != null)
    bc.setBufferLength(350);
    } catch (Exception e){
    System.err.println("Cannot create the RTP Session: " + e.getMessage());
    return false;
    // Wait for data to arrive before moving on.
    long then = System.currentTimeMillis();
    long waitingPeriod = 30000; // wait for a maximum of 30 secs.
    try{
    synchronized (dataSync) {
    while (!dataReceived &&
    System.currentTimeMillis() - then < waitingPeriod) {
    if (!dataReceived)
    System.err.println(" - Waiting for RTP data to arrive");
    dataSync.wait(1000);
    } catch (Exception e) {}
    if (!dataReceived) {
    System.err.println("No RTP data was received.");
    close();
    return false;
    return true;
    public boolean isDone() {
    return playerWindows.size() == 0;
    * Close the players and the session managers.
    protected void close() {
    for (int i = 0; i < playerWindows.size(); i++) {
    try {
    ((PlayerWindow)playerWindows.elementAt(i)).close();
    } catch (Exception e) {}
    playerWindows.removeAllElements();
    // close the RTP session.
    for (int i = 0; i < mgrs.length; i++) {
    if (mgrs[i] != null) {
    mgrs[i].removeTargets( "Closing session from AVReceive3");
    mgrs[i].dispose();
    mgrs[i] = null;
    PlayerWindow find(Player p) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.player == p)
    return pw;
    return null;
    PlayerWindow find(ReceiveStream strm) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.stream == strm)
    return pw;
    return null;
    * SessionListener.
    public synchronized void update(SessionEvent evt) {
    if (evt instanceof NewParticipantEvent) {
    Participant p = ((NewParticipantEvent)evt).getParticipant();
    System.err.println(" - A new participant had just joined: " + p.getCNAME());
    * ReceiveStreamListener
    public synchronized void update( ReceiveStreamEvent evt) {
    System.out.println("\nReceive an receiveStreamEvent:"+evt.toString());
    RTPManager mgr = (RTPManager)evt.getSource();
    Participant participant = evt.getParticipant(); // could be null.
    ReceiveStream stream = evt.getReceiveStream(); // could be null.
    System.out.println("The RTPManager is:");
    if (evt instanceof RemotePayloadChangeEvent) {
    System.err.println(" - Received an RTP PayloadChangeEvent.");
    System.err.println("Sorry, cannot handle payload change.");
    System.exit(0);
    else if (evt instanceof NewReceiveStreamEvent) {
    try {
    stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    if (ctl != null){
    System.err.println(" - Recevied new RTP stream: " + ctl.getFormat());
    } else
    System.err.println(" - Recevied new RTP stream");
    if (participant == null)
    System.err.println(" The sender of this stream had yet to be identified.");
    else {
    System.err.println(" The stream comes from: " + participant.getCNAME());
    // create a player by passing datasource to the Media Manager
    Player p = javax.media.Manager.createPlayer(ds);
    if (p == null)
    return;
    p.addControllerListener(this);
    p.realize();
    PlayerWindow pw = new PlayerWindow(p, stream);
    playerWindows.addElement(pw);
    pw.setVisible(true);
    // Notify intialize() that a new stream had arrived.
    synchronized (dataSync) {
    dataReceived = true;
    dataSync.notifyAll();
    } catch (Exception e) {
    System.err.println("NewReceiveStreamEvent exception " + e.getMessage());
    return;
    else if (evt instanceof StreamMappedEvent) {
    if (stream != null)
    if(stream.getDataSource()!=null)
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    System.err.println(" - The previously unidentified stream ");
    if (ctl != null)
    System.err.println(" " + ctl.getFormat());
    System.err.println(" had now been identified as sent by: " + participant.getCNAME());
    else if (evt instanceof ByeEvent) {
    System.err.println(" - Got \"bye\" from: " + participant.getCNAME());
    PlayerWindow pw = find(stream);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    * ControllerListener for the Players.
    public synchronized void controllerUpdate(ControllerEvent ce) {
    Player p = (Player)ce.getSourceController();
    if (p == null)
    return;
    // Get this when the internal players are realized.
    if (ce instanceof RealizeCompleteEvent) {
    PlayerWindow pw = find(p);
    if (pw == null) {
    // Some strange happened.
    System.err.println("Internal error!");
    System.exit(-1);
    pw.initialize();
    pw.setVisible(true);
    p.start();
    if (ce instanceof ControllerErrorEvent) {
    p.removeControllerListener(this);
    PlayerWindow pw = find(p);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    System.err.println("AVReceive3 internal error: " + ce);
    * A utility class to parse the session addresses.
    class SessionLabel {
    public String addr = null;
    public int port;
    public int ttl = 1;
    SessionLabel(String session) throws IllegalArgumentException {
    int off;
    String portStr = null, ttlStr = null;
    if (session != null && session.length() > 0) {
    while (session.length() > 1 && session.charAt(0) == '/')
    session = session.substring(1);
    // Now see if there's a addr specified.
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    addr = session;
    } else {
    addr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a port specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    portStr = session;
    } else {
    portStr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a ttl specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    ttlStr = session;
    } else {
    ttlStr = session.substring(0, off);
    if (addr == null)
    throw new IllegalArgumentException();
    if (portStr != null) {
    try {
    Integer integer = Integer.valueOf(portStr);
    if (integer != null)
    port = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    } else
    throw new IllegalArgumentException();
    if (ttlStr != null) {
    try {
    Integer integer = Integer.valueOf(ttlStr);
    if (integer != null)
    ttl = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    * GUI classes for the Player.
    class PlayerWindow extends Frame {
    Player player;
    ReceiveStream stream;
    PlayerWindow(Player p, ReceiveStream strm) {
    player = p;
    stream = strm;
    public void initialize() {
    add(new PlayerPanel(player));
    public void close() {
    player.close();
    setVisible(false);
    dispose();
    public void addNotify() {
    super.addNotify();
    pack();
    * GUI classes for the Player.
    class PlayerPanel extends Panel {
    Component vc, cc;
    PlayerPanel(Player p) {
    setLayout(new BorderLayout());
    if ((vc = p.getVisualComponent()) != null)
    add("Center", vc);
    if ((cc = p.getControlPanelComponent()) != null)
    add("South", cc);
    public Dimension getPreferredSize() {
    int w = 0, h = 0;
    if (vc != null) {
    Dimension size = vc.getPreferredSize();
    w = size.width;
    h = size.height;
    if (cc != null) {
    Dimension size = cc.getPreferredSize();
    if (w == 0)
    w = size.width;
    h += size.height;
    if (w < 160)
    w = 160;
    return new Dimension(w, h);
    public static void main(String argv[]) {
    //if (argv.length == 0)
    // prUsage();
    String sessions[]= new String[] {"127.0.0.1/6670","127.0.0.1/6672"};
    AVReceive3 avReceive = new AVReceive3(sessions);
    if (!avReceive.initialize()) {
    System.err.println("Failed to initialize the sessions.");
    System.exit(-1);
    // Check to see if AVReceive3 is done.
    try {
    while (!avReceive.isDone())
    Thread.sleep(1000);
    } catch (Exception e) {}
    System.err.println("Exiting AVReceive3");
    static void prUsage() {
    System.err.println("Usage: AVReceive3 <session> <session> ");
    System.err.println(" <session>: <address>/<port>/<ttl>");
    System.exit(0);
    }// end of AVReceive3
    Following is the code of RTPSocketAdapter.java:
    * RTPSocketAdapter.java
    * Created on 2007&#24180;10&#26376;30&#26085;, &#19979;&#21320;4:13
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package PlayerTest;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.DatagramSocket;
    import java.net.MulticastSocket;
    import java.net.DatagramPacket;
    import java.net.SocketException;
    import javax.media.protocol.DataSource;
    import javax.media.protocol.PushSourceStream;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.SourceTransferHandler;
    import javax.media.rtp.RTPConnector;
    import javax.media.rtp.OutputDataStream;
    * An implementation of RTPConnector based on UDP sockets.
    public class RTPSocketAdapter implements RTPConnector {
    DatagramSocket dataSock;
    DatagramSocket ctrlSock;
    InetAddress addr;
    int port;
    SockInputStream dataInStrm = null;
    SockInputStream ctrlInStrm = null;
    SockOutputStream dataOutStrm = null;
    SockOutputStream ctrlOutStrm = null;
    public RTPSocketAdapter(InetAddress addr, int port) throws IOException {
    this(addr, port, 1);
    public RTPSocketAdapter(InetAddress addr, int port, int ttl) throws IOException {
    try {
    if (addr.isMulticastAddress()) {
    dataSock = new MulticastSocket(port);
    ctrlSock = new MulticastSocket(port+1);
    ((MulticastSocket)dataSock).joinGroup(addr);
    ((MulticastSocket)dataSock).setTimeToLive(ttl);
    ((MulticastSocket)ctrlSock).joinGroup(addr);
    ((MulticastSocket)ctrlSock).setTimeToLive(ttl);
    } else {
    dataSock = new DatagramSocket(port, InetAddress.getLocalHost());
    ctrlSock = new DatagramSocket(port+1, InetAddress.getLocalHost());
    } catch (SocketException e) {
    throw new IOException(e.getMessage());
    this.addr = addr;
    this.port = port;
    * Returns an input stream to receive the RTP data.
    public PushSourceStream getDataInputStream() throws IOException {
    if (dataInStrm == null) {
    dataInStrm = new SockInputStream(dataSock, addr, port);
    dataInStrm.start();
    return dataInStrm;
    * Returns an output stream to send the RTP data.
    public OutputDataStream getDataOutputStream() throws IOException {
    if (dataOutStrm == null)
    dataOutStrm = new SockOutputStream(dataSock, addr, port);
    return dataOutStrm;
    * Returns an input stream to receive the RTCP data.
    public PushSourceStream getControlInputStream() throws IOException {
    if (ctrlInStrm == null) {
    ctrlInStrm = new SockInputStream(ctrlSock, addr, port+1);
    ctrlInStrm.start();
    return ctrlInStrm;
    * Returns an output stream to send the RTCP data.
    public OutputDataStream getControlOutputStream() throws IOException {
    if (ctrlOutStrm == null)
    ctrlOutStrm = new SockOutputStream(ctrlSock, addr, port+1);
    return ctrlOutStrm;
    * Close all the RTP, RTCP streams.
    public void close() {
    if (dataInStrm != null)
    dataInStrm.kill();
    if (ctrlInStrm != null)
    ctrlInStrm.kill();
    dataSock.close();
    ctrlSock.close();
    * Set the receive buffer size of the RTP data channel.
    * This is only a hint to the implementation. The actual implementation
    * may not be able to do anything to this.
    public void setReceiveBufferSize( int size) throws IOException {
    dataSock.setReceiveBufferSize(size);
    * Get the receive buffer size set on the RTP data channel.
    * Return -1 if the receive buffer size is not applicable for
    * the implementation.
    public int getReceiveBufferSize() {
    try {
    return dataSock.getReceiveBufferSize();
    } catch (Exception e) {
    return -1;
    * Set the send buffer size of the RTP data channel.
    * This is only a hint to the implementation. The actual implementation
    * may not be able to do anything to this.
    public void setSendBufferSize( int size) throws IOException {
    dataSock.setSendBufferSize(size);
    * Get the send buffer size set on the RTP data channel.
    * Return -1 if the send buffer size is not applicable for
    * the implementation.
    public int getSendBufferSize() {
    try {
    return dataSock.getSendBufferSize();
    } catch (Exception e) {
    return -1;
    * Return the RTCP bandwidth fraction. This value is used to
    * initialize the RTPManager. Check RTPManager for more detauls.
    * Return -1 to use the default values.
    public double getRTCPBandwidthFraction() {
    return -1;
    * Return the RTCP sender bandwidth fraction. This value is used to
    * initialize the RTPManager. Check RTPManager for more detauls.
    * Return -1 to use the default values.
    public double getRTCPSenderBandwidthFraction() {
    return -1;
    * An inner class to implement an OutputDataStream based on UDP sockets.
    class SockOutputStream implements OutputDataStream {
    DatagramSocket sock;
    InetAddress addr;
    int port;
    public SockOutputStream(DatagramSocket sock, InetAddress addr, int port) {
    this.sock = sock;
    this.addr = addr;
    this.port = port;
    public int write(byte data[], int offset, int len) {
    try {
    sock.send(new DatagramPacket(data, offset, len, addr, port));
    } catch (Exception e) {
    return -1;
    return len;
    * An inner class to implement an PushSourceStream based on UDP sockets.
    class SockInputStream extends Thread implements PushSourceStream {
    DatagramSocket sock;
    InetAddress addr;
    int port;
    boolean done = false;
    boolean dataRead = false;
    SourceTransferHandler sth = null;
    public SockInputStream(DatagramSocket sock, InetAddress addr, int port) {
    this.sock = sock;
    this.addr = addr;
    this.port = port;
    public int read(byte buffer[], int offset, int length) {
    DatagramPacket p = new DatagramPacket(buffer, offset, length, addr, port);
    try {
    sock.receive(p);
    } catch (IOException e) {
    return -1;
    synchronized (this) {
    dataRead = true;
    notify();
    System.out.println("RTPSocketAdapter receive RTP packet from port:"+port);
    System.out.println("The received RTP packet:"+new String(buffer));
    return p.getLength();
    public synchronized void start() {
    super.start();
    if (sth != null) {
    dataRead = true;
    notify();
    public synchronized void kill() {
    done = true;
    notify();
    public int getMinimumTransferSize() {
    return 2 * 1024; // twice the MTU size, just to be safe.
    public synchronized void setTransferHandler(SourceTransferHandler sth) {
    this.sth = sth;
    dataRead = true;
    notify();
    // Not applicable.
    public ContentDescriptor getContentDescriptor() {
    return null;
    // Not applicable.
    public long getContentLength() {
    return LENGTH_UNKNOWN;
    // Not applicable.
    public boolean endOfStream() {
    return false;
    // Not applicable.
    public Object[] getControls() {
    return new Object[0];
    // Not applicable.
    public Object getControl(String type) {
    return null;
    * Loop and notify the transfer handler of new data.
    public void run() {
    while (!done) {
    synchronized (this) {
    while (!dataRead && !done) {
    try {
    wait();
    } catch (InterruptedException e) { }
    dataRead = false;
    if (sth != null && !done) {
    sth.transferData(this);
    Thanks.

    The error of No format has been registered for RTP Payload type 96
    is caused by the dynamic payload mapping, when I add the dynamic mapping between dynamic payload and format. The Player cann't work yet. I think it because JMF doesn't support the format of my clips. For example:
    video: a=rtpmap:96 H263-2000/90000
    audio:a=rtpmap:97 MP4A-LATM/12000/1
    Is there some available plugin to support these format?
    Thanks

  • DNS  after reducing the advertised EDNS UDP packet size to 512 octets

    hello
    There is something wrong with my DNS server, it open internet webs so slow,and i have no idea with this .
    04-Mar-2011 14:31:57.264 zone 0.0.127.in-addr.arpa/IN/com.apple.ServerAdmin.DNS.public: loaded serial 1997022700
    04-Mar-2011 14:31:57.264 zone 15.0.168.192.in-addr.arpa/IN/com.apple.ServerAdmin.DNS.public: loaded serial 2011030204
    04-Mar-2011 14:31:57.265 zone ******/IN/com.apple.ServerAdmin.DNS.public: loaded serial 2011030404
    04-Mar-2011 14:31:57.265 zone localhost/IN/com.apple.ServerAdmin.DNS.public: loaded serial 42
    04-Mar-2011 14:31:57.265 running
    04-Mar-2011 14:32:00.066 host unreachable resolving 'b.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:7fd::1#53
    04-Mar-2011 14:32:00.261 host unreachable resolving 'r.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:500:2f::f#53
    04-Mar-2011 14:32:00.261 host unreachable resolving 'r.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:503:c27::2:30#53
    04-Mar-2011 14:32:00.261 host unreachable resolving 'r.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:503:ba3e::2:30#53
    04-Mar-2011 14:32:00.261 host unreachable resolving 'r.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:7fd::1#53
    04-Mar-2011 14:32:00.261 host unreachable resolving 'r.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:dc3::35#53
    04-Mar-2011 14:32:00.361 host unreachable resolving 'dr.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:500:1::803f:235#53
    04-Mar-2011 14:32:00.361 host unreachable resolving 'dr.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:7fd::1#53
    04-Mar-2011 14:32:00.361 host unreachable resolving 'dr.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:dc3::35#53
    04-Mar-2011 14:32:00.361 host unreachable resolving 'dr.dns-sd.udp.0.0.168.192.in-addr.arpa/PTR/IN': 2001:503:ba3e::2:30#53
    04-Mar-2011 14:32:00.866 host unreachable resolving './NS/IN': 2001:7fd::1#53
    04-Mar-2011 14:32:01.005 success resolving './NS' (in '.'?) after reducing the advertised EDNS UDP packet size to 512 octets
    04-Mar-2011 14:32:01.408 success resolving 'local/SOA' (in '.'?) after disabling EDNS
    04-Mar-2011 14:32:01.533 host unreachable resolving 't.arin.net/AAAA/IN': 2001:503:ba3e::2:30#53
    04-Mar-2011 14:32:01.534 host unreachable resolving 'v.arin.net/AAAA/IN': 2001:500:1::803f:235#53
    04-Mar-2011 14:32:01.534 host unreachable resolving 'v.arin.net/AAAA/IN': 2001:7fd::1#53
    04-Mar-2011 14:32:01.534 host unreachable resolving 'v.arin.net/AAAA/IN': 2001:503:ba3e::2:30#53
    04-Mar-2011 14:32:01.534 host unreachable resolving 'w.arin.net/A/IN': 2001:500:1::803f:235#53
    anyone help!! Thanks a lot.
    Message was edited by: leo.xue

    also interesting, when setting DNS servers IPs in Network Settings for your host,
    it is important that the IPs are not doubled.
    in example if you have Networksettings like
    automatic DHCP given from router or server.
    IP-Adress: 192.168.2.2
    Subnetmask: 255.255.255.0
    Router IP: 192.168.2.1
    DNS-Server: 127.0.0.1, 192.168.2.2
    wich means localhost and again same machine, just different IP..
    then your lookup mechanism has to walk thru this steps to know if there is nothing inside to resolve adresses.
    which means in this example it would take double the time if DNS-Server would be just 127.0.0.1
    you can see if there is a lot to work thru in your logs.
    look for something like "sizing zone task pool based on 9 zones".
    this mount of zones will change if you set the correct DNS server IP.
    more zones are slower than less, very logical!
    but this will not solve your problem with packet size at all, it just reduces circles after dns resolves not known adresses even with packet size change.

  • ASA 5510 'bounces' UDP packets. Why?

    Hi. I hope to find someone who can shed a light on something that is bugging me for days now. We have an ASA (5510, running 7.2(2)) to connect our subnets to the backbone of the ISP. I received complaints about one specific connection, which I'll "draw" here:
    [ remote host 192.87.x.y (A) ] -- {"Internet"} -- [ Telecity Router ] -- [ Our ASA ] -- [ switch ] -- [ fibre ] -- [ switch ] -- [ our host 82.199.c.d (B) ]
    What happens is the following: I can successfully ping from A to B and back. I can also traceroute (UDP) from A to B and back. But a specific UDP packet sent by A (port 9001) to B (port 5432) is causing a problem. "Our ASA" does not route the packet to the correct interface, but sends it back to the Telecity router instead. Which in turn sends it back to "Our ASA" (since it is destined for our subnet). This goes back and forth for 60 times and then the TTL is expired.
    I have no idear what is happening here. The access-lists are correctly configured (as far as I know), but even if they weren't I would expect the packets to get dropped rather than put back on the sending interface. This packet is bounced (on ethernetlevel, the IP part remains the same apart from the TTL) to the sending router.
    Any pointers as to where to look for what is causing this and how to investigate this further are highly appreciated.
    Frank

    Hi Frederico. Of course I tried the packet tracer as one of the first tools :-). It showed a complete path (I used ASDM). Now I retried it (via the CLI) and something strange happens. This is a packet trace A to B with udp from port 9001 to 5431 (not 5432):
    Phase: 1
    Type: FLOW-LOOKUP / ALLOW / Found no matching flow, creating a new flow
    Phase: 2
    Type: ROUTE-LOOKUP / ALLOW / in   my_DMZ    255.255.255.240 my_DMZ
    Phase: 3
    Type: ACCESS-LIST / ALLOW / access-group my_backbone_access_in in interface my_backbone
                                                    access-list my_backbone_access_in extended permit ip any my_DMZ 255.255.255.240
    Phase: 4
    Type: IP-OPTIONS / ALLOW
    Phase: 5
    Type: ACCESS-LIST / ALLOW / access-group my_DMZ_access_out out interface my_DMZ
                                                    access-list my_DMZ_access_out extended permit ip any object-group host_group
                                                    object-group network host_group
                                                    network-object host myHost
    Phase: 6
    Type: IP-OPTIONS / ALLOW
    Phase: 7
    Type: FLOW-CREATION / ALLOW / New flow created with id 7342770, packet dispatched to next module
    Phase: 8
    Type: ROUTE-LOOKUP / ALLOW / found next-hop myHost using egress ifc my_DMZ
                                                        adjacency Active
                                                        next-hop mac address 00bb.ccdd.eeff hits 1
    Result:
    input-interface:   my_backbone / input-status: up / input-line-status: up
    output-interface: my_DMZ / output-status: up / output-line-status: up
    Action: allow
    As you can see it is a complete path. But this is what happens if I try it for A/9001 to B/5432:
    Phase: 1
    Type: FLOW-LOOKUP / ALLOW / Found flow with id 12, using existing flow
    Module information for forward flow: snp_fp_inspect_ip_options, snp_fp_adjacency, snp_fp_fragment, snp_ifc_stat
    Module information for reverse flow: snp_fp_inspect_ip_options, snp_fp_adjacency, snp_fp_fragment, snp_ifc_stat
    Result:
    input-interface: my_backbone / input-status: up / input-line-status: up / Action: allow
    Apparently the packet is send into an existing flow (is there a command to see what this flow is?) and that is where it ends. Now I need to find out why this is happening... This firewall has been reloaded a few times, but that did not solve the problem. Any pointers are highly appreciated as was this hint.
    Frank

  • Java NIO - UDP packets

    I'm curious as to the rationale behind having a DatagramPacket class and just using ByteBuffers for TCP connections. I can see the logic, but I'm trying to write a Java framework wrapping NIO with TCP and UDP connections. In my C++ version I have one packet class that I use for both types of connections. I'm stuck with what to implement for Java as I'm going to need two classes, NIO's DatagramPacket and a new TCPPacket. Ideally I would like both to implement an interface or derive from a parent class so I can pass them to all class methods that deal with packets, be they UDP or TCP based. But this won't work. I could wrap DatagramPacket into a new class, and have it and the TCPPacket class implement a Packet interface. But when I'm sending UDP packets I'll be creating two objects for the price of one.
    Any suggestions?
    Thanks

    Remember that in UDP case you can easily lose packets and never know. In TCP you would receive an exception, but UDP can silently discard your packages while in transit.
    My point is, you probably should use a different package class for UDP anyway, maybe adding some stuff like a package ID that would enable re-sending and additional processing in order to ensure a successful communication.
    If you already have this information and some procedures for retrying in your package, then I agree with the previous poster in that you can use bytebuffer for both.

  • Can't read UDP packets

    Hi everyone. I'm triying to read the UDP packets that a board with a CPU and ethernet module is sending me via ethernet connection. In the board I've just implemented a static IP+UDP packet that only needs to change the data in order to send a temperature that the board measures. The packets are sent well and I can see them with a sniffer software like Wireshark like UDP packets with all the IP's, MACs and that stuff. The problem is that in Labview I'm not capable to read that data, even I can't read anything. I tried the UDP open + UDP read specifiying the destination port (40056 in my case).
    Any help please???
    Although, I wanted to ask if the destination IP is strictly necessary if you specify the MAC adress.
    Thank you

    CarlosSp wrote:
    Hi everyone. I'm triying to read the UDP packets that a board with a CPU and ethernet module is sending me via ethernet connection. In the board I've just implemented a static IP+UDP packet that only needs to change the data in order to send a temperature that the board measures. The packets are sent well and I can see them with a sniffer software like Wireshark like UDP packets with all the IP's, MACs and that stuff. The problem is that in Labview I'm not capable to read that data, even I can't read anything. I tried the UDP open + UDP read specifiying the destination port (40056 in my case).
    Any help please???
    Although, I wanted to ask if the destination IP is strictly necessary if you specify the MAC adress.
    Thank you
    Please post the code you are working with.
    A pictue is worth a thousand words in LV.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Cisco CSM: Duplication of udp packets possible instead of load balancing?

    Hi all,
    Does anybody know if it's possible to use the csm (WS-X6066-SLB-APC, OS 4.3.1) to duplicate udp packets to several real servers instead of balancing them.
    In our special case we want to test duplicating snmp traps to several network management systems whereas on the snmp clients only one target address (the vserver address) is configured.
    Many thanks in advance,
    Thorsten

    Hi Thorsten,
    I'm afraid this is not possible. With the CSM you can only load-balance.
    Regards
    Daniel

  • Sending udp packets using java and receiving it using c

    hi,
    Is it possible to send udp packets using java and receive the same using c??????? if yes.... plz help immediately.

    The biggest issue is data format. The JVM is big endian, with 16-bit characters. The machine running 'C' could be almost anything. A (signed!) byte array is probably the easiest unit of exchange.
    The Java program has its own techniques for storing/retrieving data to/from the byte array - and the C program has its own techniques. ASCII Strings are often the easiest to exchange - just convert the java String objects to byte array and send them.
    apaliwal1 has already given the UDP calls to send/receive the data.

  • How can I disable SSDP UDP packets in Firefox nightly?

    Recently I started using the Firefox e10s nightlies. I notice they send out SSDP UDP packets. How can I disable Firefox SSDP? Thanks
    gecko.buildID = 20141114030206
    gecko.mstone = 36.0a1

    I'm not seeing anything in the source code.
    *http://mxr.mozilla.org/mozilla-central/source/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm
    *https://tools.ietf.org/html/draft-cai-ssdp-v1-03

  • UDPevent? What should I use to make an event when an UDP packet arrives?

    every time my machine gets an UDP packet I need to write out the time(within millisec), and therefor I need to find an eventnotifier of some kind that checks for UDP packets arriving..

    oki.. so I'm building a class for reciving the packets.. I guess i should use a thread since my program allredy is reciving these packets whit JMF - reciveStream.
    now the problem is, how do I write out the time for each packet, i cant seem to find any events i can use for this, and as far as I can see, the datagarmsocket is listening for the packets and doing something with them(**) without somewhere for me to put the: System.out.printeln(time);
    (**) I am going to write the packets to a file and parse it for the sequence numbers, how do I do this?

  • How can i attach a user-speci​fied header to each UDP packet?

    Hello,
    i have here a question about UDP:
    i want to stream live-videos using UDP. To avoid/observe some possible problems that could occur (e.g. wrong packet-order, packet loss etc.) i am planning to add a header to each UDP packet with e.g. frame-nr. , frame-size, packet-nr...
    Question:
    1. (How) Can i control the UDP packet size in LabVIEW?
    2. If possible, how can i add a user specified header to each/certain (e.g. the first or the last packet of the frame) packet?
    Thanks!
    WLAN
    Message Edited by wlan on 01-26-2007 03:02 AM

    WLAN,
    i just copied the help regarding the max size-terminal from the LV-help:
    "max size is the maximum number of bytes to read. The default is 548. Windows If you wire a value other than 548 to this input, Windows might return an error because the function cannot read fewer bytes than are in a packet"
    So, please do not change this value....
    UDP creates packets from the data you transmitt. Each packet in Windows should have a size of 548 bytes or less. So this should read one whole packet at a time.... Decreasing this could lead to problems if the packet is larger.... Increasing this value changes nothing since the packets themselfs do not get larger only by trying to read more bytes..... Since you cannot alter the packetsize from LV, you shouldnt bother about that anymore.
    And to add (again): UDP does not garantuee ANY correct transission. So you will never get any note if the first packet of a frame was lost. If you need some kind of garantuee for this, you have to use TCP (btw. infact, the TCP header uses 192 bytes, containing the infos like seen in the attached gif).
    regards,
    NorbertMessage Edited by Norbert B on 01-31-2007 11:12 AM
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.
    Attachments:
    tcp_header.gif ‏9 KB

  • IP Multicast: UDP Packet size!

    Hi,
              Does anyone know what is the size of the UDP packets which WLS
              allocates to receive broadcast messages in a clsutered enviroment. I am
              running into issues as we have a limitation on JVM/platform combination,
              where we can have message size of only 32K be allocated for UDP packets
              ?? Is ther eany way to configure WLS to use smaller packet sizes?
              TIA,
              Sam
              

    WLS uses 32 K. UDP packets by default. So, you should not have any problems
              on our certified platforms.
              Are you by any chance trying to run the server on Tandem?
              Thanks,
              Michael
              Michael Girdley
              WLS Product Manager
              Sam <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              > Does anyone know what is the size of the UDP packets which WLS
              > allocates to receive broadcast messages in a clsutered enviroment. I am
              > running into issues as we have a limitation on JVM/platform combination,
              > where we can have message size of only 32K be allocated for UDP packets
              > ?? Is ther eany way to configure WLS to use smaller packet sizes?
              >
              > TIA,
              >
              > Sam
              >
              

  • UDP packet checksum error

    We got two SF4800 running Oracle RAC on Solaris 9 and Sun Cluster 3.1. We found the udpInCksumErrs counter dumps up suddenly when the server loading increases. We tried to use an packet analyzer software to monitor a mirrored network ports of them, but failed to find any UDP packets with incorrect check sum.
    What is the meaning of udpInCksumErrs? Will it affect the system?

    As far as I know, the Sun Cluster heartbeat does not use UDP. It just uses raw ethernet frames of type 0833. You can see these if you do a snoop on the interface. I pretty sure that the UDP packets are from the Oracle RAC distributed lock manager/cache fusion.
    I would have thought, again, that RAC would create the packets it needed and ask Solaris to send them. (I'm checking this with a colleague). From scanning the bugs database, it would appear that there are a number of recommendations:
    * Ensure the latest patches have been applied
    * Make sure the system has been installed in accordance with Sun's EIS checklist (if Sun installed the system this would have happened).
    Which says:
    When using supported network adapters which use the ce driver for private
    transport, insert into file /etc/system:
    set ce:ce_taskq_disable=1
    Also see InfoDoc:79189
    Tim
    ---

  • Not receiving UDP packet with Windows

    Using a Windows 2000 Professional system I send a UDP packet (DatagramSocket()/DatagramPacket()) to a server, which returns a UDP packet on the same socket. Simple textbook stuff! The Java application works fine on a Linux machine, but catches an SocketException with "socket closed" message from the receive() method when run on a Windows 2000 machine. What gives? I have disabled the security checks and still can't get the packet. Any suggestions? (other than ditch Windows)

    I got the same problem. I ran the identical program on WinXP and no exception! What's the cause for this? How to avoid it?
    Thanks,

  • What to do with received udp packet

    Hello I can finally send and receive data with udp.
    But now I receive a packet
    socket.receive(packet);
    But how can I get the ipaddress, portnumber and data from the packet?
    I know I can get the byte length with socket.getLength.

    did you bother looking at the API docs for DatagramPacket?

Maybe you are looking for

  • Find out if the content will be rendered in "edit" mode programmatically

    I need to use redirect to send user to different page for certain reason. I use HttpPortletRendererUtil.sendRedirect() to accomplish the task. It works fine. The problem is I do not want it redirect in page modes other than "show" mode. Is there a wa

  • Fie system repository in the km

    Hi, I am working on the file system repository in KM.I have created the  the windows system.But i was unable to see the windows system that wihch i was created in content admin->km content.Can anybody help on this. Thanks , vinodh

  • Connecting to mysql database, http 500 error

    I have dreamweaver cs3, I have setup my site, set up my testing server and am trying to setup my mysql connection. I am on a windows xp pro. My testing server is on a local network connection and is running ISS 5, PHP 5, and mysql 5. I am going to ru

  • My key pad not showing when editing contacts.

    The key pad is not coming up when I try to add or edit my contacts

  • Selection Tools et al

    I have tried everything to get the various selection tools, healing brushes, etc to work on the pictures I have uploaded to my computer either from my digital camera or via scanning - and I can't get any of the tools to work.  I have tried not using