UDP sending 2048bytes on Network

Hi, I am using LabVIEW 6i. I am trying to send 2048bytes of data to another PC in the Network using UDP. And I have modified the example programs given with LabVIEW i.e.
UDP_Sender.vi and UDP_Receiver.vi etc to send and receive 2048bytes but it is not getting any data. I heard that there may be chances of losing data in UDP but here it is not
getting any of the data at all.
Here with I have attached both the VIs. I tried to send data in sender vi with 1ms wait in loop. And tried to receive 10ms wait and 10ms of timeout on receiver even than it is not getting any data. I tried 1ms on both the side but not succeeded.
Here we want to find out, what is the maximum data LabVIEW can send to other PC using UDP and practically how much time require to receive sent data.
Is there anybody who can guige me please? Anybody know anyway to do this thing!
Attachments:
UDP Receiver_2048_Remote.vi ‏39 KB
UDP Sender_2048_To_Remote.vi ‏38 KB

Though it sounds like you might have already been warned, let me reiterate: Unless you are going to create a protocol yourself that addresses UDP's short coming, sending data using UDP is a very, very bad idea. This protocol is very fast but the reason for its speed is that it implements NO error correction or any sort of data verification. For example, if a packet comes up missing you'll never know it. If packets come out of order due to varied routing paths, you'll never know it. If a packet is corrupted, you'll never know it.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Similar Messages

  • Increase UDP sending size over 64k bytes and get error -113,sending buffer not enough

    Dear all,
    I have a case that I must send a data over 64k bytes in a socket with UDP . I got a error-113 shows "A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.".I searched for this issue and got the closest answer as below:
    http://digital.ni.com/public.nsf/allkb/D5AC7E8AE545322D8625730100604F2D?OpenDocument
    It said I have to change buffer size with Wsock.dll. I used the same mathod to increaes the send buffer to 131072 bytes by choice optionname to so_sndbuf (x1001) and give it value with 131072 and it worked fine without error. However I still got an error 113 while sending data with " UDP Write.vi ". It seems UDP write.vi reset the buffer size? Are there any other things cause the error?
    I attached example code. In UDP Sender.vi you can see I change send buffer size to 131072 and send date included a 65536 bytes data.There is also a UDP receiver.vi and there is some missing VI which you can get from the LINK. But it's not necessary.
    Attachments:
    UDP Sender.vi ‏14 KB
    UDP Receiver.vi ‏16 KB
    UDP_set_send_buffer.vi ‏16 KB

    The header for a UDP packet includes a 16 bit field that defines the size of the UDP message (HEADER AND DATA)
    16 bits limits you to a total size of 65635 bytes, minus the header sizes; a minimum of 20 bytes are required to define an IP packet and 8 bytes for UDP leaving an effective data payload of 65507
     bytes.
    LabVIEW is not the issue...
    http://en.wikipedia.org/wiki/User_Datagram_Protocol#Packet_structure
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • UDP Send and Receive with Remote Host Only Issue

    I am seeing an issue using the UDP Sender and UDP Receiver example VIs that ship with LabVIEW. If I open the VIs and do not change any of the settings and run the UDP Receiver VI and then the UDP Sender VI the Receiver VI never reads anything. However if I change the boolean on the UDP Sender VI to broadcast it works fine.  
    The example program by default uses localhost so I have also tried to use the UDP Receiver on my Real Time controller and the UDP Sender on my laptop with the boolean set to remote host only and the remote host string set to the ip address of my real time controller and this did not work either. But if I change the boolean to broadcast it works.
    I would like to be able to send to a remote host only and not have to broadcast my UDP message to everyone.
    Please let me know if you have any suggestions.
    Thanks,
    Russell 
    Engineering Team Leader
    G Systems, www.gsystems.com
    Certified LabVIEW Architect
    Certified Professional Instructor

    Elizabeth,
    Thank you for the response. I am using LV 8.2.1 and wasn't seeing any errors. 
    However I am not seeing the issue today, I must have been an issue with our network yesterday.
    Thank you,
    Russell 
    Engineering Team Leader
    G Systems, www.gsystems.com
    Certified LabVIEW Architect
    Certified Professional Instructor

  • I'm using UDP Send to send an 1D arry with 3 elements. On the other side I'm using UDP Read to read my 1D arry with 3 elements but they are coming in a string for somereason.

    Using UDP send to send a data across a connection to UDP read data by using a Port and IP. The data I'm sending is 1D array with 3-elements. I'm taking the 1D array on UDP send side and converting to a string before I send out b/c UDP can not read an array. So I'm using "Array to Spreadsheet String" to and sending it.
    On the Other Side I'm using UDP Read to read the data by listing to a port and capturing the data. I'm receving the data but they are in string format instead of 3 spreate elements. So how can I change that to 3 elements instead of string?
    Any help would be grea
    tful,
    Thanks
    Attachments:
    udp_send_data.vi ‏54 KB
    UDP_read_data.vi ‏55 KB

    It is usually easiest to take any data and flatten it to string before sending.
    On the receiving side, use unflatten from string, using the original data type as template.
    You can do this with any kind of data (array of strings, array of numbers, booleans, complicated clusters, etc, etc), see attached code image.
    Flatten and unflatten is very efficient and does not change the data. For example there is no rounding or formatting loss.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FlattenUnflatten.gif ‏7 KB

  • A really basic UDP sender

    Hi,
    I am trying to make a basic UDP sender. I want to send the average speed of a vehicle to another computer by UDP. I saw an example in Labview 7.1 database: UDP sender.vi.
    What I need to know:
    How do I find my local and remote port number?
    Is the remote host address, the IP address?
    Thanks a lot for your help,
    Have a nice day,
    Phil

    See my example in this recent thread.
    The remote port number is determined by the listening port of the server. You need to find out. (Many port numbers are assigned by IANA to certain services. For example, if this is a syslog server, you would need to send to remote port 514/UDP.)
    The remote host address is the IP address expressed as U32 number. USe String-to-IP to translate a hostname (e.g. ni.com) or dotted-decimal IP address (e.g. 192.168.100.100) to the correct format.
    In many cases, the local port is irrelevant. Often it is easiest to simply wire a zero to it. In this case, the OS will automatically choose a free ephemeral port. (If you choose a specific local port, there is always a finite chance that this particular port is already in use, giving you an error.).
    LabVIEW Champion . Do more with less code and in less time .

  • Open udp port on Wireless Network

    I have a WLC2106 with 6 APs model 1240AG. An application uses port 11050 UDP for license management. The client send a broadcast on this port looking by the server, because this information is NOT passing through, the connection can't be established. With the original network (3com), there is no any problem but with Cisco network, this particular port appears to be closed. How can I confirm the AP is blocking this port? How can I open it? I tried with an ACL but the problem was not fixed.
    thanks in advance.

    Eric:
    Thanks so much for your support. Finally I have the application working.
    I found the problem was not with the UDP port alone, the problem was with all broadcast (your tips give me ligth).
    Besides the "Broadcasting Forwarding" option I changed the "Ethernet Multicast Mode" to Multicast.
    The key was this paragraph in the release notes:
    Re-enable Broadcast after Upgrading to Release 4.0.206.0
    In software releases 4.0.179.0 and earlier, broadcast and multicast forwarding were both controlled with a single global flag that enabled multicast. Beginning with software release 4.0.206.0, these functions were broken into separate configuration flags: one that controls broadcast and one that controls non-broadcast multicast. If you have multicast enabled in software releases 4.0.179.0 and earlier, the broadcast flag is left disabled after upgrading to software release 4.0.206.0. As a result, some applications that rely on broadcast do not work after the upgrade.
    After you upgrade to software release 4.0.206.0, use this CLI command to re-enable broadcast:
    config network broadcast enable
    When re-enabled, broadcast uses the multicast mode configured on the controller.
    To be honest I am not very clear how the multicast mode is related with the problem, but now I can see all the broadcast messages passing through wireless network.
    Thanks a lot
    Daniel Escalante.

  • Messages won't send on certain networks

    I get this message when trying to send my messages on certain wireless networks.
    The connection to the server “smtp.home.se” on port 25 timed out.
    You can try to send using a different server. All messages will use this server until you quit or change your network settings.
    I would love to know why it doesn't work. Thanks a lot.
    Daniel

    Are these wireless networks paid or free?
    If you are accessing a wireless network at a friend's residence - most, if not all ISPs now block the use of SMTP servers outside of their network on Port 25. Some ISPs allow the use of an authenticated SMTP server only that is outside of their network on Port 25 but block its use regardless.
    These restrictions are in place as part of an overall effort to prevent or reduce spam emanating from the ISP's domain.
    In most situations like this, changing the Port for the SMTP server from 25 to 587 will resolve it. Go to Mail > Preferences > Accounts and under the Account Information tab for the account preferences at the SMTP server selection, select the Server Settings button below.
    Enter 587 in place of 25 in the Server Port field and when finished, select OK to save the changed setting. When exiting Mail preferences, select OK to save the changed account settings if prompted.
    For some wireless access points such as at a Coffee shop or other, etc. which sometimes require payment for access and this SMTP server is authenticated, changing the authentication to None sometimes resolves it.
    Basically, you need to determine the internet service provider for the wireless network being used and their restrictions/requirements for using an SMTP server that is outside of the ISP's network or that isn't provided by that ISP.

  • UDP Sender and Receiver.

    Hi! I want to know if it is possible to convert the file UDPSender.java into a method that can be called by clicking a button? I slightly modified the UDPReceiver.java for it to be listening indefinitely and UDPSender.java I found on the net. And I created a what is supposedly my main file called Button.java.
    What I want to do is that for this Button.java which only has a button when clicked is supposed to do a UDPSender. But I have no idea how to do it. Hope someone can answer this.
    ====================================================================================================================
    ====================================================================================================================
    The code below is for UDPReceiver.java
    ====================================================================================================================
    ====================================================================================================================
    * @(#)UDPReceiver.java
    * @author
    * @version 1.00 2008/10/19
    import java.net.*;
    import java.util.*;
    import java.io.*;
    public class UDPReceiver {
         * Creates a new instance of <code>UDPReceiver</code>.
        public UDPReceiver() {
         * @param args the command line arguments
        public static void main(String args[]){
            try{
                 //Bound to socket 7 for receive
                 DatagramSocket socket = new DatagramSocket(7);
                 System.out.println("Bound to local port " +socket.getLocalPort());
                 while(true){
                      //Create packet of 512 byte length
                      DatagramPacket packet = new DatagramPacket(new byte[512], 512);
                      socket.receive(packet);
                      System.out.println("Packet received at " +new Date());
                      //Display packet information
                      InetAddress remote_addr = packet.getAddress();
                      System.out.println("Sender: " +remote_addr.getHostAddress());
                      System.out.println("from Port: " +packet.getPort());
                      //Display packet contents, by reading from byte array
                      ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData());
                      //Display only up to the length of the original UDP packet
                         for(int i=0; i<packet.getLength(); i++){
                           int data = bin.read();
                           if(data==-1)
                                break;
                           else
                                System.out.println((char)data);
            catch (IOException e) {
                   System.out.println ("Error - " + e);
    }====================================================================================================================
    ====================================================================================================================
    This code is for UDPSender.java
    ====================================================================================================================
    ====================================================================================================================
    * @(#)UDPSender.java
    * @author
    * @version 1.00 2008/10/19
    import java.net.*;
    import java.util.*;
    import java.io.*;
    public class UDPSender {
         * Creates a new instance of <code>UDPSender</code>.
        public UDPSender() {   
         * @param args the command line arguments
         public static void main(String args[]){
             //Set hostname and message
            String hostname = "localhost";
            String message = "Hello";
            try{
                 //Create a datagram socket and look for the first available port
                 DatagramSocket socket = new DatagramSocket();
                 System.out.println("Using local port: " +socket.getLocalPort());
                 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
                 PrintStream pOut = new PrintStream(bOut);
                 pOut.print(message);
                 //Convert printstream to byte array
                 byte[] bArray = bOut.toByteArray();
                 //Create a datagram packet containing a maximum buffer of 512 bytes
                 DatagramPacket packet = new DatagramPacket(bArray, bArray.length);
                 System.out.println("Looking for hostname " +hostname);
                 //Get the InetAddress object
                 InetAddress remote_addr = InetAddress.getByName(hostname);
                 //Check host IP
                 System.out.println("Hostname has IP address = " +remote_addr.getHostAddress());
                 //Configure DatagramPacket
                 packet.setAddress(remote_addr);
                 packet.setPort(7);
                 //Send packet
                 socket.send(packet);
                 System.out.println("Packet sent at " +new Date());
                 //Display packet information
                 System.out.println("Sent by: " +remote_addr.getHostAddress());
                 System.out.println("Send from: " +packet.getPort());      
             catch (UnknownHostException ue){
                   System.out.println("Unknown host "+hostname);
              catch (IOException e) {
                   System.out.println ("Error - " + e);
    }====================================================================================================================
    ====================================================================================================================
    This is supposedly my main class file:
    ====================================================================================================================
    ====================================================================================================================
    * @(#)Button.java
    * @author
    * @version 1.00 2008/10/16
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.Applet.*;
    public class Button extends JApplet implements ActionListener{
         public static void main(String[] args){
         JFrame frame = new JFrame();
         frame.setVisible(true);
         JPanel panel = new JPanel();
         JButton button = new JButton("send text");
         panel.add(button);
         frame.add(panel);
         frame.pack();
         public void actionPerformed(ActionEvent evt) {
              //Button.EchoClient();
    }Edited by: Eastsheen on Oct 20, 2008 12:33 AM

    You could call UDPSender.main(new String[0])

  • Sending data through network takes forever

    hi fellow java developper
    i'm developping a program that hides files contents trough xml messages in order to exchange securily from a intranet to an extranet whitout having to use ftp and port 21. The problem is it takes over 22 seconds to send a 22k from the server and it takes about 85 seconds to receive it on the client side. this is driving me nuts because i know that delay is extremely high. IS there a way to optimized those to following methods so that the delay is reasonnably cut down
    thanks in advance
    here is my code to send and receive data,
    private BufferedInputStream inBuffer; // input buffer
    private BufferedOutputStream outBuffer; // output buffer
    * Method to send a String to the client
    * @param content is the string to send to client
    public void send(String message) throws IOException
    ByteArrayOutputStream streamOfBytes;
         DataOutputStream insStream_Out;
         streamOfBytes = new ByteArrayOutputStream(message.length());
    insStream_Out = new DataOutputStream(streamOfBytes);
         for (int i = 0; i < message.length(); i++)
              insStream_Out.write((byte)message.charAt(i));
         outBuffer.write(streamOfBytes.toByteArray(), 0,streamOfBytes.size());
         outBuffer.flush();
         * This method permit reception of string messages
         * @param a single character identifying the terminator to avoid receiving garbage
         * @return a string containing the message
         public String receive(char terminal) throws IOException
         char c;
         String message = "";
    long start = System.currentTimeMillis();
    int i = 0;
         while ((c = (char)inBuffer.read()) != terminal)
         message = message + String.valueOf(c);
    i++;
         long end = System.currentTimeMillis();
    System.out.println("temps requis recevoir:" + (end - start) +" ms nbboucle:"+i);
    return message ;
         }

    Hmmm.. there are a few optimization possibilities here, both with respect to creating bytes and retrieving text from bytes again. This is more close to the way java does it, and also the recommended way:// Push data out to a byte[] like this:
    String data; // initialized elsewhere
    ByteArrayOutputStream target = new ByteArrayOutputStream( data.length() );
    DataOutputStream stream = new DataOutputStream();
    stream.writeUTF( data );
    stream.flush();
    byte[] bytes = target.toByteArray();
    // Read data in from an InputStream like this:
    InputStream input; // initialized elsewhere
    DataInputStream stream = new DataInputStream( input );
    StringBuffer result = new StringBuffer();
    try
       // terminates with an EOFException
       // (ridicolous, but that is what the specification says...
       while( true )
          result.append( stream.readUTF() );
    catch( EOFException e )
    return result.toString();However, if your code works, the times you talk about is probably not connected to bad code (unless your XML is really really big) but more likely to network problems. Note that if your output string results in a byte array larger than 65535 bytes, a DataFormatException will be thrown from writeUTF (so the method fails). In that case, you will have to use OutputStreamWriter / InputStreamWriter and specify encoding to be e.g. UTF-8.
    Good luck!
    Daniel

  • How do I send Windows-friendly network drive links using Mail (in Tiger)?

    I'm in an office with mostly Windows users (and Windows NT servers). Most folks use Windows email applications such as Outlook and Outlook Express. I use Apple Mail 2.1.3 (753.1) in Tiger v10.4.11. But I want to send links within my emails to files on our various network drives and have the receiving Windows/Outlook users click the links to automatically open the various files, but I can't get this to work. Any ideas on how to format the network links so they work this way?
    I don't log into the network drives normally until I want to access things, perhaps I should. But I've tried this and still no go.

    Thanks, but I've tried this in a variety of ways, none of which seem to work. So there's more detail required. Here's some background and examples of what I've tried without success.
    The Windows WORKGROUP is, say, "JAMESCORP" - but what's the equivalent in Apple networking to a Workgroup? And does this even matter? It seems to not matter?
    The Windows drives are mapped on Windows machines as, say, F: G: H: I: etc... But I don't know what the equivalent concept of mapping drives is on an Apple (more on smb, below). I typically don't map Windows' network drives (I use VMWare Fusion) on the Windows side since I did not like the constant Windows messages reminding me each time I'm out of the office that it can't find the Drive F:. Then it can't find Drive G: - etc. ad infinitum. What a pain.
    On the Apple side, I use Finder's command-K to smb into the server that contains all the partitioned drives. In the smb list, the drive names are, say, mapp-cdrv and mapp-ddrv etc (which, in Windows map to F: and G: respectively).
    So when you type "servername" - I'm lost regarding just what the servername should really be? Is it:
    a) F: (which does not work for a Windows user once it's delivered via Apple Mail to an Microsoft Outlook email) So this seems to not be the proper servername - or if it is, there's a translation happening in the delivery mechanism that makes it not work. (I "Add Hyperlink" from the Edit menu to get the link into an Apple Mail message.)
    b) mapp-cdrv (which works on an Apple, but when sent to a Windows machine's email (e.g., Outlook) does not work - so this isn't it. This servername is not something the Windows machines understand
    c) cifs://workgroup;""me@<ip address of server>/mapp-cdrv (which, again, doesn't work on a Windows machine once sent thru Apple Mail).
    I've tried a variety of other permutations of "servername" - both Windows-like server names and Apple-like server names - but none seem to work once delivered the way I'm delivering the links (thru Apple Mail to Outlook.)
    Any other ideas? Thanks for the help! ; )

  • Need to send data across network, what is the dataStructure for my data?

    using JXTA, i want to send file or messages among the peers.
    the data should contain the ACK

    Hello Dear Programmer Look please I need to know what is the data transfer Structure is to say make sent a sample Data structure
    to cross throughout Network
    to be compile in Java
    My Regard
    Alfonso Franco
    [email protected]

  • Problem with sending message over network

    ssc = (ServerSocketConnection) Connector.open("socket://:5000");
    sc = (SocketConnection) Connector.open("socket://localhost:5000");my app works over the network in the emulator, but wont work on real devices, or do i just need to pair somehow with the device before i start.
    are the above lines okay is it meant to be localhost that's what they use in the socket part of the network demo that comes with the wireless toolkit, anyone have any ideas why that app doesnt seem to work for me on the real devices.
    i know for bluetooth you have to pair with the device before running the application do you have to do something like this

    Vishal,
    Couple of questions. 
    How are you sending this message.  Is it a message that you create and send Internally with an attachment.
    As you reply me, please also check if the <b>Attachments folder</b> has been set under <b>Administration > System Initialization > General Settings.....Path Tab</b>
    SBO tries to copy the attachment from the location you select to the Path defined for Attachments.
    Let me know
    Suda

  • Network Game - Sending Over a network question

    I am going to make my first network game.
    I have read tutorials on networking and have designed an echoserver.
    I am however not sure how to pass player moves over the network. I know that it will work the same way as strings
    but how do I pass other players new positions so I can then broadcast changes to all other clients.
    Thanks in advance for any help
    Marc

    you could use serialization, but that can be too big an overhead when you have a lot of players. I would use a simple messaging system, where you send strings over the network in a specific format that you can create on the sending side and unpack on the receiving side. Something like:
    ID;PARAMS
    where ID is a messageId identifying the specific type of message you are sending, and PARAMS is a list of parameters that depend on the message type. For example a movement message could be:
    1;R;40
    This would then mean that the player moved 40 "units" to the Right. A very simple example, of course adapt to your game's situation.
    The advantage of a system like this is that you can string together multiple messages and send them at once. At the receiving end you can just keep parsing messages from the string until there is no more data.
    If you are really tight on bandwidth, then you'll have to start packing bits in binary data in stead. I would go for the messaging system first though, it is the easiest to get working.

  • Receiving texts but not sending or calling, networks fine.

    Present network, receives texts but doesnt send, call (sorry we are experiencing technical difficulites) and no internet (Safari cannot open the page because it is not connected to the internet) HELLLPPP
    I have rebootyed it and reset all network settings ect
    It is an iPhone 4

    Have you contacted your carrier?
    They can send a reset to your iPhone which must be powered off when this is done, so call from a landline.
    Or the SIM card may have a problem and needs to be replaced.

  • UDP Send receive

    I am trying to make an application to send and receive on UDP port 1234. The client is sending from a ramdom port aand expects the response from port 1234 of the server to the port the client sent from. So far it is working for both sending and receiving but when sending back it is using a random port to send from instead of from port 1234. Any ideas?
    import java.net.DatagramPacket;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    public class Server{
        Thread thread;
        DatagramSocket socket;
        public static void main(String[] args) {
            Server u = new Server();
        public Server(){
            new StartThread();
        public class StartThread implements Runnable{
            StartThread(){
                thread = new Thread(this);
                thread.start();
            public void StopThread() {
                thread.interrupted();
                socket.close();
            public void run(){
                try{
                    // receive buffer
                    byte[] buffer = new byte[12];
                    // send buffer
                    byte[] sbuffer = new byte[20];
                    // listen to this port
                    int port = 1234;
                    try{
                        socket = new DatagramSocket(port);
                        while(true){
                            try{
                                for (int i=0; i<11; i++ ) {
                                    buffer=0;
    DatagramPacket packet = new DatagramPacket(buffer, buffer.length );
    socket.receive(packet);
    InetAddress client = packet.getAddress();
    byte[] iByte = null;
    iByte=client.getAddress();
    int client_port = packet.getPort();
    String r = String.format("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", buffer[0], buffer[1],buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], buffer[8], buffer[9], buffer[10], buffer[11]);
    String from = new String();
    String test = new String(buffer);
    from = "From "+client +" " +client_port;
    test = test.substring(0,4);
    System.out.println(from);
    // display to screen data received in hex
    System.out.println(r);
    // check for STOP to exit application
    if (test .equals("STOP")) {
    System.out.println("UDP Listener Stopped");
    StopThread();
    //set up send back what was received except first 4 bytes
    int temp = 0;
    temp=0x000000FF & ((int)buffer[4]);
    sbuffer[0] = (byte)temp;
    temp=0x000000FF & ((int)buffer[5]);
    sbuffer[1] = (byte)temp;
    temp=0x000000FF & ((int)buffer[6]);
    sbuffer[2] = (byte)temp;
    temp=0x000000FF & ((int)buffer[7]);
    sbuffer[3] = (byte)temp;
    temp=0x000000FF & ((int)buffer[8]);
    sbuffer[4] = (byte)temp;
    temp=0x000000FF & ((int)buffer[9]);
    sbuffer[5] = (byte)temp;
    temp=0x000000FF & ((int)buffer[10]);
    sbuffer[6] = (byte)temp;
    temp=0x000000FF & ((int)buffer[11]);
    sbuffer[7] = (byte)temp;
    //sent data has from ip
    sbuffer[8] = iByte[0];
    sbuffer[9] = iByte[1];
    sbuffer[10] = iByte[2];
    sbuffer[11] = iByte[3];
    //sent data has from port
    temp=0x000000FF & (client_port);
    sbuffer[12] = (byte)temp;
    temp=0x0000FF00 & (client_port);
    sbuffer[13] = (byte)temp;
    //pad some junk
    temp=0x000000FF & ((int)0);
    sbuffer[14] = (byte)temp;
    temp=0x000000FF & ((int)66);
    sbuffer[15] = (byte)temp;
    //# of users
    temp=0x000000FF & ((int)0);
    sbuffer[16] = (byte)temp;
    temp=0x000000FF & ((int)0);
    sbuffer[17] = (byte)temp;
    temp=0x000000FF & ((int)0);
    sbuffer[18] = (byte)temp;
    temp=0x000000FF & ((int)20);
    sbuffer[19] = (byte)temp;
    DatagramPacket sndPkg = new DatagramPacket(sbuffer, 20, client, client_port);
    DatagramSocket snd = new DatagramSocket();
    // send the data back
    // this is where i get confused, how to send back from 1234 to client_port
    snd.send(sndPkg);
    String to = new String();
    to = "To "+client+" "+client_port;
    String s = String.format("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", sbuffer[0], sbuffer[1],sbuffer[2], sbuffer[3], sbuffer[4], sbuffer[5], sbuffer[6], sbuffer[7], sbuffer[8], sbuffer[9], sbuffer[10], sbuffer[11], sbuffer[12], sbuffer[13], sbuffer[14], sbuffer[15], sbuffer[16], sbuffer[17], sbuffer[18], sbuffer[19]);
    System.out.println(to);
    System.out.println(s);
    catch(UnknownHostException ue){}
    catch(java.net.BindException b){}
    catch (IOException e){
    System.err.println(e);

    I could be wrong, but when you assign this value you can get one of two results from DatagramPacket.getPort().
    API says: +the port number on the remote host to which this datagram is being sent or from which the datagram was received.+
    int client_port = packet.getPort();If you've already made sure that value is correct, then I'm stumped.

Maybe you are looking for

  • Adobe exchange panel does not load in cc applications

    I cannot launch the Adobe Exchange Panel in Photoshop or Illustrator.  The option to launch this extension is not available in my menu.  In Photoshop "Extensions is grayed out".  In Illustrator it is not grayed out but it is simply not populated.  I

  • What do those pre-boot kernel messages mean?

    Hi, directly after grub there are some lines printed on the screen (by the ramdisk or kernel?) and I don't know for sure what they mean. Especially the marked ones: :Loading Initramfs 963: No such process IP-Config: no device to configure Waiting 0s

  • 23" CHD-Display (ADC) flicker rushes

    You have to see it to believe it: http://www.wysiwyg.de/23/ - quicktime movie filmed from screen Magenta-coloured pixelstorms rush over the entire screen, producing weird dithered artefacts. Card is an ATI 9000 Pro V250, but I already swapped it, sti

  • Trouble With update 10.5.8 to 10.6.8

    My mac os x is on software 10.5.8 and i want to updated it to the newest update, update 10.6.8 but when i click software update my computer says software is up to date but its not so what can i do to fix it? its also preventing me from downloading it

  • Opening IE printPreview window with a bean

    Hi. everyone! I was wondering if anyone has had luck in utilizing the features of IE's browser controls. I can get the print preview window to open with JavaScript but I have the need to have the backer bean to do this. Do I have access to the browse