FileInputStreams and UDP packets revisited.

Sorry about the second post, but some issues have arisen that I just cannot seem to solve.
I'm trying to take a raw image file that will act as a video frame and read it in to an internal buffer. From there, I need to extract the header from the file (see below for header format) and set some variables based on the header. After that, I need to use those variables to create individual headers for each packet that I'm going to send to the video client and send the rest of the data with 32kbyte packets.
I understand that FileInputStream has a read() method that will read in an array of bytes up to it's length, and it seems to be the easiest way to do it, but my dilemma is in dissecting the file and extracting the header from it.
The image (ppm format) file looks like so:
P3
50 50
255
0 0 70 0 0 70 0 0 70 0 0 70 0 0 70 etc.
Where "P3" on a line by itself is a verification that this is indeed a PPM file
"50 50" on a line by itself is the xwidth and ywidth of the raster of pixels
"255" on a line by itself is the max RGB color value
After that, the data follows which is a raster of pixels made up of 3 bytes, one for Red, one for Green, one for Blue, with an unknown amount of whitespace only between the blue value of one pixel and the red value of the next.
I apologize for the lengthy topic but I hope it may incite some debate and get some people thinking maybe!? Because it sure did stump me. Any help is greatly appreciated. Thanks a lot, folks!

>
Initially, my problem was just reading in the file, now I'm unsure what the best way is to extract the header from the raster of pixels from an array of bytes, or if there's a way I can read it in as strings, or if I should read it in as an array of chars, or what. Here's the link to the original thread if necessary:
Why do you want to read it in as strings? i hope that the video data is not stored in the file as strings! As if it is then it is wasting a huge amount of space, nearly twice the space that is needed.
When you say that ## is on a line by it self you mean that it seperated by a line feed? if it is then it means that you are using a text file to store the video data which is a waste. Or is the ppm format a hybrid text binary file? i am not familar with the format.
If it is firstly text and then binary then use a buffered reader to read in three lines for the "P3", "50 50" and "255" and then directly read the bytes from the rest of the file.

Similar Messages

  • 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.

  • 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

  • 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.

  • 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

  • TCP and UDP

    I press the button of guild in windows media player, which will connect internet in the window of player.
    i use tool test their TCP and UDP. the result is that the most connections is TCP, there is little conection using UDP. i want to ask what is the TCP use for and UDP use for when conecting internet?
    However when i use media player to play online movie and raido. there is only TCP connection, there is no UDP connection. Anyone can tell me why?
    i think it is not efficient to use TCP when playing online movie or radio, because it involve frequently connect.

    the microsoft would not want the miss any packets.If a packet gets lost on the way from the server to the player, the server just keeps sending data. It is usually better to have some momentary glitch in the audio / video than to stop everything and wait for the missing data to arrive.
    Actually, UDP is commonly used for streaming audio / video precisely because it offers speed.
    Of course, streaming servers can use TCP, but by default most of them use better protocols like RTSP (Real Time Streaming Protocol) or UDP.
    In your case, it might be that the Windows Media server had initially attempted to send data using UDP. For some reason(s) (firewall settings, UDP port closed etc..), it was unable to do so and then used TCP as an alternative :
    http://www.microsoft.com/windows/windowsmedia/compare/webservvstreamserv.aspx

  • JMF and UDP (No RTP?!)

    Hello!
    I've posted some questions in this forum, but I didn't find an answer to my problem up to now. I have an network which is streaming Mpeg2/Mpeg4 over an Mpeg2 Transport Stream (encapsulated in IP/UDP packets). RTP is not supported! I am searching for an solution to watch this stream in Java.
    I think JMStudio isn't able to do streaming without UDP?! Does anyone have some experiences with this? Maybe there is an small testing enviroment or any source that might help me?!
    I would be very grateful for any answer!
    Thx, Jan Stanetzki.

    RTP is an aplication protocol (layer 5: aplication, in TCP/IP model) to transport media in real time.
    RTP is over (or uses) UDP (layer 4: transport, in TCP/IP model).
    So, JMF, by default, uses RTP, that uses UDP to transport media in time real.
    If you want to change the transport protocol, you must to create your own rtpconnector.
    One example of this: http://java.sun.com/products/java-media/jmf/2.1.1/solutions/RTPConnector.html
    But you need to learn basic and advanced concepts of networking.

  • What is the difference between "UDP Multicast open.vi " and "UDP open.vi " ?

    What is the difference between "UDP Multicast open.vi " and "UDP open.vi " ?

    Someone correct me if i am wrong, the difference is "multicast"
    -Based on my General Computer Network knowledge, multicast means sending data/packets to selected group of nodes. Which will be UDP multicast
    -UDP open.vi might be for unicast which is to one node specifically.
    -One more difference is in first one(multicast open), you have additional read,write and read write funcionality which is not available in normal UDP open.vi
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • 294.What is the difference between TCP and UDP

    What is the difference between TCP and UDP

    The difference between TCP and UDP is that UDP throws datagram packets over the wire not concerned whether it arrives at its destination or not. TCP attempts to facilitate the notion of a connection by requiring an acknowledgement by the recipient and continually resending the packets until it receives the acknowledgement or gets a timeout. In a way TCP can be thought of as a layer over UDP but it's more than that. A good analogy is the beginning of the school day vs the end of the school day. In the beginning children enter school in a line and in an orderly fashion. Each child is accounted for. Each child has a defined classroom destination. Likewise TCP packets are sequenced, accounted for, and have a certain destination. At the end of the day all the kids pour out of the building randomly with no regard of whether their buddies are on detention or not. Any particular kid could be heading straight home or to the mall and no accounting is taken. In the same way UPD packets are dispersed from the sender without regard for order. Any packet to make a pit stop at a particular router on the network and no accounting is done to ensure it makes it all the way to the recipient.

  • 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
    ---

Maybe you are looking for

  • Connection Timed Out error when I try to access Alert Inbox

    Hi experts, I have not been looking at my alert inbox for a while and I suspect it's very full. When I tried to open the alert inbox from RWB, I encountered the following error: <b>500 Connection timed out Error: -5 Version: 7000 Component: ICM Date/

  • Lync 2013 FE pool with two server limitions

    Hi, I have some query about Lync 2013 FE pool with two FE servers. 1. if I deploy two servers in the one FE pool so what happen if one fe server down ? 2. will windows fabric work? Thanks.

  • Receiving error after installation when attempting to open Cricut Craft room.

    Receiving error after installation when attempting to open Cricut Craft room. It says 'Application Descriptor cannot be found for this application." I have tried uninstalling/reinstalling/installing older version. Any ideas?

  • Cisco CME 4.1 Factory Reset

    Hello, I hope this post finds itself in the correct place.  I have a Cisco 1760 Router with CME 4.1 running on it.  We have had some changes and I would like to completely wipe the configuration on it.  I would like to keep the actual firmware ios op

  • Finally got Gmail to work on my iphone 6

    I was having an issue getting gmail to load on iphone 6 and finally figured it out. Settings Mail, Contacts, Calendars Add Account Choose Google Enter > Name Email (including @gmail.com) Password (if you have 2 step verification see below first) if y