Receiving UDP datagrams?

Hello,
I have a C library I've been using for a while which allows text
messages to be embedded unto UDP datagrams and sent from one
application to another over a local Ethernet. I've used it for several
years with no problems.
At the moment, I'm trying to take one of the application which uses
this library, and send some of its results over the network to a
Labview application. I've been trying to start by looking at the
udpex.lib example VI's, and loading the Spray Receiver VI.
I figured that if I set the Spray Receiver's port number to the same
port as I'm broadcasting messages to, then I should see the messages
that are being passed around. However, I don't- the receiver always
times out. Similarly, if I use the Spray Sende
r to broadcast to the
same port as I'm listening to, I would expect to receive a datagram in
my C code, but nothing appears.
Running the Spray Sender and Spray Receiver VI's together seems to
work fine- I see the messages bouncing back and forth between them.
I'm pretty sure I have the port numbers and other parameters set
appropriately, but I'm stumped as to why I'm getting no indications of
messages passing back and forth between the Labview and C sides. Can
anyone suggest anything to look for, particularly something that might
help someone who (at least, thinks) knows the win32 UDP well, but is
just getting started with LabView?
Thanks,
Les Elkins
Spatial Inttegrated Systems, Inc.

Dennis Knutson wrote in message news:<[email protected]>...
> All I can say is that I once used the LabVIEW VIs to connect to a UDP
> write written in Visual Basic just by using the UDP Open and UDP Read
> functions. I looked back at my old code and saw that the only thing I
> did was change the max size and timeout values. I don't know about
> Spray Sender or Spray Receiver VIs. Where did you find them?
The Spray Sender and Spray Receiver VI's are examples for an Application
Note on TCP/IP and UDP. I don't have the full title at hand, but the note
is referenced in the UDP section of the manual.
This certainly looks like something that should 'just work', but I'm not there yet...
Thanks,
Les Elkins

Similar Messages

  • Identifying the Destination Address of a Received UDP Datagram

    I have a application where a potentially large number of IP addresses route to a single host. I need to listen for UDP datagrams on that host, and to be able to determine the IP address to which any received datagrams were originally sent. Unfortunately, the DatagramPacket API only appears to let me query the source address of the datagram, even though the destination addrerss is most certainly present in the actual UDP datagram.
    This seems like an oversight in the API. Has anyone encountered this problem before? Are there any known solutions? I am afraid I will have to resort to JNI.

    I know as well as you that the address returned is what was bound to. But he mentioned no where that he was only bound and listening on the default. As far as either of us knows he may be listening to specific addresses on a number of threads and funneling all packets through a single "queue" (not that this would be efficient). If he is doing something to that effect, then this will work. It could also be that he has extended a class to do the listening with a specific method that determines where to forward the packets to and that method is trying to inspect the Packets to determine where they go, so that it does not need a predefined bind address, but can work independently after a thread spun-off with serversocket.accept. Both scenarios make the socket.getLocalAddress an acceptable solution.
    As they say, there is more than one way to skin a cat.
    Instead of attacking, ask simply why that advice was given, or say simply that under "these" circumstances that would not be a workable solution. Do not simply attack me out of your perceived notion of my intelligence level. I will admit I should have a made a few qualifiers to the advice given, but that did not make it fundamentally wrong.

  • Send and receive UDP data package based on siemens TC65 module

    Everyone:
    I am newer for J2ME. I have a TC65 module, I want to get a sending and receiving UDP data package exeample codes running on TC65. who can help me? thanks!

    Hi deepspace,
    I programmed a demo codes and run it on TC65T, debug trace like :
    at^sjra=a:/NetDemo.jar
    OK
    NetDemo: Constructor
    NetDemo: startApp
    NetDemo: Profile could not be activated
    NetDemo: destroyApp(true)
    // below is demo codes, can you help me where error is?
    package example.netdemo;
    import javax.microedition.midlet.*;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.io.Datagram;
    import javax.microedition.io.DatagramConnection;
    public class NetDemo extends MIDlet {
    public NetDemo()
    System.out.println("NetDemo: Constructor");
    public void startApp() throws MIDletStateChangeException
    System.out.println("NetDemo: startApp");
    try
    DatagramConnection conn = (DatagramConnection) Connector.open("datagram://58.185.157.91:12003");
    byte[] buffer = new byte[32];
    Datagram dgram = conn.newDatagram(buffer, buffer.length);
    for (int i = 0; i < 30; i++) {
    buffer[i] = (byte)('0' + (i % 10));
    conn.send(dgram);
    catch (Exception e)
    System.out.println("NetDemo: " + e.getMessage());
    destroyApp(true);
    public void pauseApp() {
    System.out.println("NetDemo: pauseApp()");
    public void destroyApp(boolean cond) {
    System.out.println("NetDemo: destroyApp(" + cond + ")");
    notifyDestroyed();
    }

  • Using Multicast to send a UDP Datagram

    hey,
    i am implementing a kind of descovering mode on a mobile application.
    there for i wanna send a udp datagram to a configured multicast adress.
    unfortunately i didn't find anything useful on the net. is it even possible ?
    also to listen on this address ?
    thx for help

    Not possible!

  • Broadcast large UDP datagrams between VLANs

    Hello,
    I wish to broadcast large UDP packets between two VLANs (on the one set of stacked 3750 switches).
    I have setup an ip helper which allows me to broadcast between vlans. That works fine, but I am limited to datagrams around 5912 bytes in size.
    I want to be able to broadcast larger datagrams.
    I can successfully broadcast larger datagrams (65000-ish bytes) within the one vlan, but not between two vlans.
    Am I able to increase the size of broadcast UDP datagrams between vlans and if so, how?
    Thanks in advance.

    Disclaimer
    The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
    Liability Disclaimer
    In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
    Posting
    Hmm, I'm wondering whether a helper cannot forward fragments.
    If not, if you enable jumbo support on the 3750, you might be able to send larger diagrams, but perhaps not larger than MTU.

  • Standalone application can't receive UDP message

    Hello all!
    I have a small vi (part of a bigger program) working to receive udp messages sent by another device in the LAN. It works well when it's a normal vi, but
    when I built an exe of this vi, I don't see any udp message received by the exe. Anybody got any idea of this? Here is my vi, and thanks in advance!
    Solved!
    Go to Solution.

    Definitely check the firewall rules. An application is by default not automatically entitled to create sockets on random ports. Usually you get a dialog by the firewall software on first startup of an application, if you want to allow it to access network functionality. But it's easy to dismiss that dialog without reading it carefully and sometimes Windows doesn't even seem to prompt you. And then the firewall rule is normally set to deny any and all network access for the executable.
    To not push viruses and other malignant software with the nose on the fact that it has been blocked, a firewall rule will often let the API calls succeed but simplyact as if there is no network available.
    And the firewall rules are assigned based on executable name AND location of the executable in the file system. So moving the executable somewhere else will basically mean a new application and require its own firewall rules.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • UDP Datagram package receive question

    With my program I send a datagrampackage and then wait for a package to receive.
    Is it possible to print an error when you don't receive a package within a second and the program stops waiting for a package to receive but will do the next step in the program.
    Something like
    send packet
    wait for packet
    if no packet received in 1 second try again or print error

    well, the receive method blocks, but you can call setSoTimeout() before calling receive to set the timeout time. If you set it to a positive value, it'll only block that long and throw an exception when it times out, at which time you can catch the exception and do your thing.

  • Unable to receive UDP broadcast packets on PPP connection

    I am struggling for two days now with no success. I have two modems (do not ask, some special stuff), that uses dial up (PPP) connection. I tried this on windows XP and it works like a charm. I am sending unicast and broadcast UPD packets. If I
    repeat that on Windows 7 i can send only unicast data, broadcast packets seems to be lost somewhere. I tried to use Microsoft Network Monitor and I can see that broadcasted packets are being received on my PPP connection. But after that, they are gone. Somewhere
    in the kernel. I truly do not understand why. I disabled firewall, antivirus, base filtering engine, tried to log dropped packed in Windows
    Filtering Platform, tried clean WIN7 machine and all that with no success.
    Here is a sample packet received on interface, but it has newer reach my app:
    No. Time Source Destination Protocol Length Info
    1 13:20:56.093380000 192.168.1.50 192.168.1.255 UDP 49 Source port: x11 Destination port: x11
    Frame 1: 49 bytes on wire (392 bits), 49 bytes captured (392 bits)
    Encapsulation type: Ethernet (1)
    Arrival Time: May 7, 2014 13:20:56.093380000 Central Europe Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1399461656.093380000 seconds
    [Time delta from previous captured frame: 0.000000000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 0.000000000 seconds]
    Frame Number: 1
    Frame Length: 49 bytes (392 bits)
    Capture Length: 49 bytes (392 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:udp:data:vssmonitoring]
    [Coloring Rule Name: UDP]
    [Coloring Rule String: udp]
    Ethernet II, Src: ae:4e:20:00:01:00 (ae:4e:20:00:01:00), Dst: Xerox_00:00:00 (01:00:01:00:00:00)
    Destination: Xerox_00:00:00 (01:00:01:00:00:00)
    Address: Xerox_00:00:00 (01:00:01:00:00:00)
    .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    .... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast)
    Source: ae:4e:20:00:01:00 (ae:4e:20:00:01:00)
    Address: ae:4e:20:00:01:00 (ae:4e:20:00:01:00)
    .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
    .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IP (0x0800)
    Internet Protocol Version 4, Src: 192.168.1.50 (192.168.1.50), Dst: 192.168.1.255 (192.168.1.255)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
    0000 00.. = Differentiated Services Codepoint: Default (0x00)
    .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
    Total Length: 34
    Identification: 0x0032 (50)
    Flags: 0x00
    0... .... = Reserved bit: Not set
    .0.. .... = Don't fragment: Not set
    ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 126
    Protocol: UDP (17)
    Header checksum: 0xb817 [correct]
    [Good: True]
    [Bad: False]
    Source: 192.168.1.50 (192.168.1.50)
    Destination: 192.168.1.255 (192.168.1.255)
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
    User Datagram Protocol, Src Port: x11 (6001), Dst Port: x11 (6001)
    Source port: x11 (6001)
    Destination port: x11 (6001)
    Length: 14
    Checksum: 0xafd1 [validation disabled]
    [Good Checksum: False]
    [Bad Checksum: False]
    Data (6 bytes)
    0000 34 34 34 34 34 34 444444
    Data: 343434343434
    [Length: 6]
    VSS-Monitoring ethernet trailer, Source Port: 127
    Src Port: 127
    I am running out of my ideas, if anyone could help, with any idea, please do. I am not sure if this feature is dropped in win7 or not.

    Hi,
    From your description, you may gather the network monitor traces to ensure which part lost UDP broadcast packets.
    Thank you.
    Best regards,
    Stevens Song 
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • CISCO  Gigabit switch / Java UDP datagram

    Hi,
    1. I experience flooding of UDP packets and machine freeze when put rate is high. Using java MulticastSocket and Datagrams.
    2. Tested with 2 machines to be in same multicast group, observerd that packets go to all other machines also which are not in multicast group.
    Enabled IGMP snooping on CISCO switch but same problem. Looks like IGMP forwarding table is not correct.
    Any help?
    Thanks

    1. I experience flooding of UDP packets and machine freeze when put rate is high. Using java MulticastSocket and Datagrams. Freeze at the sender or the receiver?
    2. Tested with 2 machines to be in same multicast group, observerd that packets go to all other machines also which are not in multicast group.That's correct. Multicasts will go to all hosts behind a given router. What they won't do is go through the router, unless the router thinks there's a member on the other side.

  • Help: Send and Receive through Datagram Socket

    I am trying to create a client/server using Datagram Socket (UDP) as communication. I have a Recive and a Send class that implements runnable and are responsible for receiving and sending of message. I have two other classes Server and Client that are utilizing these. Now i can get the receive and send to work fine, but i am having trouble retrieving the message from the receive thread that i created in each of server/client. I've tried inserting a method so the server/client can call on to get the message (Receive.Get_Message()) but unfortunately this isn't working as i wanted. Since my server and clients are not implemented as runnables, i can only issue the command in some serialize fashion. What i really want to do is that whenever the message is receive by the Receive thread, it will immediately be send back to server/client and display right then, independent of what i was doing. (i have a command interface for S/C so it just sits there to wait for command, now what i would like is to have the S/C display the message it gets immediately after it gets it even when it's waiting for user input. since my program is waiting for a command, i really could not use the method describe above to achieve this) Could anyone help me with this?
    Thanks!
    Hung-Hsun Su

    u cant use the observer pattern. or at least i can't figure out how to implement it with sockets.
    you should use threading.
    public void run()
      while(true)
         //keep reading from socket
         InStream output = socket.getInputStream();
         InputStreamReader ir = new InputStreamReader(output)
         BufferedReader reader = new BufferedReader(ir);
         String s = null;
         while(s == null)
           s = reader.readLine();
         //then do whatever you want to the received string "s"
    }

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

  • PDA only receives UDP data when connected to PC; fails wirelessly

    I have a UDP sender on PC, a receive program in PDA running Windows Mobile 5.0.
    The wired thing is when I connect the PDA with PC through USB cable, receiver program in PDA works fine; but when disconnected, receiver program does not read UDP data any more. 

    Here is the Sender program, everytime it runs, it broadcasts a 'T' or 'F' to all addresses. 
    Here is the receiver program. It is constantly running reading the broadcast message. When PDA is connected to PC, it receives fine; when it disconnects, it does not receive any thing. 

  • UDP Datagram Reply Issue

    Hello Everyone....
    I'm doing a project in which i need to send datagrams to clients waiting on particular port. I want the client to reply to the server's port from which the datagram is sent. Is this possible ?
    I have tried this by creating a DatagramSocket with empty constructor and sent the packet to the particular port on client. In turn, on receiving the packet from the server, the client sends the reply to the port got from received DatagramPacket's getPort method.. But, I'm not getting the packet back to the server.
    Please help me...
    Thanking you in advance...
    R. Kaja Mohideen

    Received DatagramPacket already has source address and port set, so you could simply do:
    packet.setData(.....);
    socket.send(packet);

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

  • How to make udp datagram pass thru proxy server?

    I have to make a video stream system. And I found that there are a lot of user is behind the firewall or proxy server, how should i do to make the udp streaming media pass thru the firewall or proxy????
    does the https tunnel help?

    Thanks for your advise, but does http tunnel only accept for the TCP problem? since my server will broadcast a stream of udp to the user, so how should i do that?

Maybe you are looking for

  • Catalyst 10.2 on Ati HD 5450 not working

    Hi all! I have a problem with catalyst from ati.amd.com After boot black screen with a cursor xorg.conf # Auto-generated by Archie mkxcfg # Auto-generated by Archie mkxcfg Section "ServerLayout" Identifier "aticonfig Layout" Screen 0 "aticonfig-Scree

  • Itunes privileges error

    1. I recieved a new iphone 4 after a repair right as itunes 10.5 was released. 2. In order to activate my phone I needed to sync with itunes, so I decided to update itunes before I activated my phone so it would download the new features. 3a. During

  • Can they really do this??

     As everyone here I have been working on improving my credit situation. I had a smal Chase account charged off which has fallen off of my credit reports as it was cahrged off with first deliquency way back in 2008, it feel off a few months ago. I pul

  • Disappearing iCloud notes interface in Chrome

    When I load iCloud notes in Chrome, the navigation on the top and left shows up only as white space.  You can still use it if you remember where to click, but the interface is invisible.  Finding and using the navigation on the left bar makes it reap

  • I want to extend the range of my Time Capsule, can I use Universal WiFi Range Extender, 4-port WiFi Adapter WN2000RPT?

    I want to extend the range of my Time Capsule, can I use Universal WiFi Range Extender, 4-port WiFi Adapter WN2000RPT?