How to send joystick data over TCP connection

Hi all,
I am a long time Labview discussion forum user for learning, but this is my first time posting a question, I hope somebody can help me!
In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
Again, the actual TCP communication I get, and can operate fine, just formatting all the data into a string (or whatever is required) so that I can unpack on the other side is the issue here.
Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense...
One final question.....I already have a solution to this but using labview for the entirety of this project would be nice. I use skype to stream 1080p video from a webcam to my computer so I can view live feed. Can labview do this? This would be awesome if so, I am just not sure if the communication protocols in use could support real time (or as close as possible to streaming) for 1080p video.
Thanks all in advance for your help,
Physicsnole
Attachments:
cameraserver.vi ‏24 KB
cameraclient.vi ‏18 KB

Physicsnole wrote:
In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
Well, you cast the axis info cluster to a string, but then you cast it back to an array of DBL. Thatr's not compatible. You should probably cast it back to an "axis info" cluster of exactly the same type. Go the the other VI and right-click the cluster wire to create a constant. Now move that diagram cluster constant to the other VI and use it as type.
Your default ports don't seem to match. You seem to have client and server roles confused. In the sever you create a listener, but then you start sending packets, even though no connection is established. The connection needs to be initiated by the client.
Your client stops the loop the first time a timeout is encountered. Shouldn't that be more permanent? Also, please retain code clarity and avoid unecessary complexities. For example, replace the "not or" with a plain "or" and change the loop to "stop if true"
Physicsnole wrote:
Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
You can send as much as you want. The casting to/from string is the same as described above.
Physicsnole wrote:
Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense..
The primary function of a "server" is to wait for a connection and then communicate with the client once a conenction is established. An established TCP/IP connection is fully two-way and both sides can send and receive.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • How to send class data over TCP/IP like a serialized cluster

    I have a device which communicates over a TCP/IP connection.  I need to construct complex messages for the communications.  If I use type-defs clusters it is a simple matter to convert the data to string and send it out.  Same with getting the data in.
    If I try this with classes (which I really want to use instead of type-def clusters) I don't get my data in the same format I want it to be in.  It gives me a bunch of stuff I don't want or need like the name of the class.
    I can do some crazy shenanigans like below but this will break if my data type ever changes.
    In addition to that problem some of my classes will contain other classes as data members.  For example all messages have a message header as their beginning so a separate message header class will be part of all other classes.
    Is there a built in / simple way to do this?
    Thanks for the help,
    James G. 
    Attachments:
    class to cluster.JPG ‏11 KB

    Got it. I thought the receiving device was running LabVIEW You could write a method for your class to return the data in whatever format you want.
    =====================
    LabVIEW 2012

  • How can i use an existing vpn connection without using the option "Send all traffic over vpn connection"?

    I have been trying to get my computer (os x.7) to astablish a remote desktop connection to my work computer via a vpn tunnel. In fact I have just discovered that it works fine if i select to "send all traffic over vpn connection" from the options in the advanced setup of the vpn.
    If the option is selected microsofts "Remote desktop connection for mac" works just fine. However without selecting the option it is not taking advantage of the tunnel but tries to connect as if the tunnel would not exist.
    Now the question is how do I get program to use the vpn tunnel without checking the above option?
    Thanks for any hints and pointers.

    Then can her computer be authorized to both accounts?
    Absolutely. You can authorize any given computer to up to five iTunes Store accounts.
    If purchases are made on her account, to a computer authorized to my account, can I put those songs on my iPod?
    If you connect your iPod to her computer, yes. Tracks download only to the computer from which they're purchased, regardless of which iTunes Store account is used for the purchase. Or you could copy the tracks from her computer to yours and then authorize your computer to her iTunes Store account. But that's sort of defeating the original purpose, it would seem to me.
    is it better to buy music through Amazon downloads and/or actually purchasing CDs to avoid the security features iTunes puts on its music?
    That's certainly an option. If it's an entire album I want, I buy CDs. That way I can import them at the quality I want and to whichever of my systems I want. Amazon or one of the other download stores that offer tracks as MP3 are also an option, though for me download stores are best when you just want a couple of tracks off a given CD.

  • How to send string data through socket!

    Is there any method to send string data over socket.
    and if client send string data to server,
    How to get that data in server?
    Comments please!

    Thank for your kind answer, stoopidboi.
    I solved the ploblem. ^^;
    I open the source code ^^; wow~~~~~!
    It will useful to many people. I spend almost 3 days to solve this problem.
    The program works like this.
    Client side // string data ------------------------> Server side // saving file
    To
    < Server Side >
    * Server.java
    * Auther : [email protected]
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Server extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectInputStream input;
         DataOutputStream output;
         FileOutputStream resultFile;
         DataInputStream inputd;
         public Server(){
              super("Server");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent ev){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display),
                     BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runServer(){
              ServerSocket server;
              Socket connection;
              int counter = 1;
              display.setText("");
              try{
                   server = new ServerSocket(8800, 100);
                   while(true){
                        display.append("Waiting for connection\n");
                        connection = server.accept();
                        display.append( counter + " connection is ok.\n");
                        display.append("Connection " + counter +
                             "received from: " + connection.getInetAddress().getHostName());
                        resultFile = new FileOutputStream("hi.txt");
                        output = new DataOutputStream(resultFile);
                        output.flush();
                        inputd = new DataInputStream(
                             connection.getInputStream()
                        display.append("\nGod I/O stream, I/O is opened\n");
                        enter.setEnabled(true);
                        try{
                             while(true){
                                  output.write(inputd.readByte());
                        catch(NullPointerException e){
                             display.append("Null pointer Exception");
                        catch(IOException e){
                             display.append("\nIOException Occured!");
                        if(resultFile != null){
                             resultFile.flush();
                             resultFile.close();
                        display.append("\nUser Terminate connection");
                        enter.setEnabled(false);
                        resultFile.close();
                        inputd.close();
                        output.close();
                        connection.close();
                        ++counter;
              catch(EOFException eof){
                   System.out.println("Client Terminate Connection");
              catch(IOException io){
                   io.printStackTrace();
              display.append("File is created!");
         public static void main(String[] args){
              Server app = new Server();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runServer();
    < Client side >
    * Client.java
    * Auther : [email protected]
    package Client;
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Client extends JFrame
         private JTextField enter;
         private JTextArea display;
         DataOutputStream output;
         String message = "";
         public Client(){
              super("Client");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent e){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display), BorderLayout.CENTER);
              message = message + "TT0102LO12312OB23423PO2323123423423423423" +
                        "MO234234LS2423346234LM2342341234ME23423423RQ12313123213" +
                        "SR234234234234IU234234234234OR12312312WQ123123123XD1231232" +
                   "Addednewlinehere\nwowowowwoww";
              setSize(300, 150);
              show();
         public void runClient(){
              Socket client;
              try{
                   display.setText("Attemption Connection...\n");
                   client = new Socket(InetAddress.getByName("127.0.0.1"), 8800);
                   display.append("Connected to : = " +
                          client.getInetAddress().getHostName());
                   output = new DataOutputStream(
                        client.getOutputStream()
                   output.flush();
                   display.append("\nGot I/O Stream, Stream is opened!\n");
                   enter.setEnabled(true);
                   try{
                        output.writeBytes(message);
                   catch(IOException ev){
                        display.append("\nIOException occured!\n");
                   if(output != null) output.flush();
                   display.append("Closing connection.\n");
                   output.close();
                   client.close();
              catch(IOException ioe){
                   ioe.printStackTrace();
         public static void main(String[] args){
              Client app = new Client();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runClient();

  • How to send the data from mac pc to External drive

    how to send the data from mac pc to External HDD
    or Pen Drive but with out deleting the preview as data

    You can use "Finder", which is in your dock, to copy files from your iMac folders over to the external hard drive.
    Hope this helps

  • Need help : how to send 3 parameters over http using Java POST

    I am trying to sending some data to agency company over http using Java POST
    They need 3 parameters and some contents like below
    1. Cmd : cmd=_RequestInsertNewLead
    2 Live : False
    3 XMLData : 3C%3Fxml+version%3D%........
    I already have XML done ,but I don't know how to send these guy over http
    is that like
    this.out = new DataOutputStream(os);
    out.writeBytes("Cmd");
    out.writeBytes(" cmd=_RequestInsertNewLead");
    out.writeBytes(" Live ");
    out.writeBytes("False");
    anyone could give help :)

    First of all, are you getting any exception?
    You didn't put much logging information in your code.
    You can also try this.Instead of doing sos.println(".....") try to build the output string using string buffer.
    Like:
    StringBuffer sb = new StringBuffer();
    sb.append("Some output");
    sb.append("More output");
    sos.print(sb.toString());
    sos.flush();Let me know if this works.

  • How to send the data manually

    Hi Experts,
      I need small information.when messages are gone into queue state due to one message 
    When an EDI file came into wrong format and with that some messages are gone into queue state in MONI.
    if i cancel the first message then remaining all the messages are processing successfully.
    So from that cancel message i want sent the data manually as business needs that data.
    Can all please tell  me how to send the data manually with steps.
    Thanks in Advance.
    Bhaskar

    Hi,
    I think you are talking about QoS "EOIO", in which all messages are porcessed in FIFO order and whenever the preceeding message get stuck due to error in the queue, then all the messages are stoped. And yes as soon as you will cancel the message which went into error all the remaining messages will automatically will be delivered.
    In my opinion since QoS is EOIO then it will be not possible to sent the data mannually, you can do one thing, do not cancel the message. Try to correct the messge and then resend it.
    Regards,
    Sarvesh

  • How to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 using ftp

    how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet

    Hello
    For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
    Also, take a look at FTP Browser.vi, which is available at the Example Finder.
    To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
    Post your current VI if possible.
    Regards
    Mondoni

  • Hi friends, How to send any data (even binary) through XI, without using

    1) How to send any data (even binary) through XI, without using the Integration Repository .?

    hi ganga,
    Yes; 
    1. we can test adapters very easily and quickly without any IR development.
    2. we can send any formatted data without having to convert it to XML and back again, e.g. file->XI->file.
    3. we can send any document from 1 sender to multiple receivers using XI to guarantee delivery.
    /people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
    the process integration layer of the NetWeaver  define/reuse interface objects for the SAP Integration Repository. These objects include Business Scenarios, Business Processes, Message Interfaces, Message Types, Data Types, Message Mappings, and Interface Mappings. The application developer refers to these objects in defining the interactive flow between applications for the SAP Integration Directory.
    regards,
    nikhil

  • C++ can send a "struct" over TCP.How to do the same fuction with JAVA?

    as Title~
    C++ send a struct like the following...
    NEO_MSG neo_msg;
    struct NEO_MSG
    int iPortRecv; // port for recv data of client
    char verify;
    ////After create a TCP connection....
    send(ServerSock, (char*)&neo_msg, sizeof(neo_msg), 0);
    How to rewrite it with JAVA?

    If you are trying to do it in a way that is compatible with C++, then you'll need to write the bytes to the socket. You can do this by wrapping the socket's output stream with a DataOutputStream, then writing each value in order.
    Remember that a C++ struct is just a convention of accessing a linear array of bytes, so the above is equivalent.
    If you are just trying to send an Object's data over a socket (to another Java app), then you can wrap the socket's output stream with an ObjectOutputStream, then just write the object to it.
    - K

  • How to read data over tcp/ip using labview

    Hi,
    I have a network enabled force transducer (6-axis load cell). I know its IP addr. and the data format it is sending the data out (7 32-bit DWORD, One status and 6 axis force data) . I have been playing around with the simple data client.vi example program. 
    When I executed the program using the devices IP addr. I used to get error 63: TCP/IP connection open. Then I ran the program using localhost in IP addr field, the program executes now indefinetly at one block only. I am attaching the screenshot for ref. 
    Thanks.
    Sasi.
    Attachments:
    TCP-IP.JPG ‏62 KB

    Hello,
    I'm wondering if you can create a rather simple VI that just tries to open and close a TCP connecting to your transducer. All you would need is a TCP Open and a TCP Close wired together with the proper IP address etc. Does this run? I did look to see if there was any NetFT information and I could not find anything. I feel that the problem lies in the communication protocol between your transducer. Another place to see if you can connect to it would be to try hyperterminal. You can access this in Windows XP by clicking Start»All Programs»Accessories»Communications»HypeTermina. Using this, you can try and connect to your instrument with TCP/IP outside of LabVIEW. You might also want to get in contact with the manufacturer to verify that third-party software can indeed communicate with it. There may be a specific set of instructions that need to be sent to the transducer in order to initiate the connection and then read from it. These may be in the form of serial commands that would need to be sent over TCP. What is the make and model of your transducer?
    -Zach
    Certified LabVIEW Developer

  • I'm using a 1D Arrary with 27 different elements and would like to send those data over UDP Write and UDP Read functions.

    I'm using a 1D array with 27 different elements. I would like to transfer that data over a UDP connection, and read it back by using UDP connections.
    But I would like to read 3 elements at a time (On read side) and send those to 9 different ports.
    Note: the data will go to only one PC with one Network Address)
    * 1st elements (0,1,2) and send to port #XXX to see those 1st 3 elements.
    * continue until the elements reaches up to 27
    This is what I have done but I'm finding myself in pitfalls...
    Send side:
    I'm using a UDP Open connection on send side to send my data. So with selected a Source Port, I have created a UDP Op
    en connection. I�m using only one source port to send all the data across the channel. I would like to read 1st 3 elements and send those data across with an assigned Destination port. I would like to do that for 9 times b/c there are 27 elements in the array. So I�m using a For Loop and setting N count to 9. So I�m not getting any errors when I execute and no answer on the other side at all.
    Read side:
    I�m using a UDP Open connection to read in the data with port #. I�m using while loop to with Boolean inside by making a true all the time. Inside that While loop, I�m using For Loop to read the 3 elements data a time and send to a right port address. (As start out I was just trying to see if it works for only one port).
    Attachments:
    UDP_SEND_1.vi ‏40 KB
    UDP_READ_1.vi ‏31 KB

    You are not getting any errors because UDP is a connectionless protocol. It does not care if anyone receives it. Your example will work fine with the following considerations.
    (1) Don't use the generic broadcast address (255.255.255.255).
    (2) You are listening on port 30000. So why are you sending to port 1502, nobody will receive anything there.
    The destination port of the outgoing connection must match the server port of the listener. (The source port is irrelevant, set ot to zero and the system will use a free ephemeral port).
    (3) On the receiving side, you are not indexing on the received string, thus you only retain the last received element. Then you place the indicator outside the while loop where it never gets updated. :-(
    (4) Do yourself a favor and don't micromanage how the data is sent across. Just take the entire array, flatten it to string, send it across, receive it, unflatten back to array, and get on with the task.
    (You can do the same with any kind of data).
    I have modified your VI with some reasonable default values (destination IP = 127.0.0.1 (localhost)), thus you can run both on the same PC for testing "as is". Just run the "read" first, then every time you run "send", new data will be received.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    UDP_READ_1MOD.vi ‏29 KB
    UDP_SEND_1MOD.vi ‏27 KB

  • Receive data through TCP connection

    Hi
    I'm receiving a string "Hello" from TCP from a C-program, where I have to display this string in a string indicator in LabVIEW. 
    I have the following block diagram I found among the examples: 
    The point here is that I can only read the last character "o" in the indicator when I change the "bytes to read" value to 4 bytes, but can read the characters "ello" when setting the bytes to read value to 1. How do I read the whole "Hello" string ?. 
    Best regards
    Oesen
    Attachments:
    Simple TCP - Client.vi ‏15 KB

    Since you are sending a string, I would try using "CLRN" mode on TCP Read.  Then you can trigger it to read all the text until the "/r/n" characters in C.
    mode indicates the behavior of the read operation.
    0
    Standard (default)—Waits until all bytes you specify in bytes to read arrive or until timeout ms runs out. Returns the number of bytes read so far. If fewer bytes than the number of bytes you requested arrive, returns the partial number of bytes and reports a timeout error.
    1
    Buffered—Waits until all bytes you specify in bytes to read arrive or until timeout ms runs out. If fewer bytes than the number you requested arrive, returns no bytes and reports a timeout error.
    2
    CRLF—Waits until all bytes you specify in bytes to read arrive or until the function receives a CR (carriage return) followed by a LF (linefeed) within the number of bytes you specify in bytes to read or until timeout ms runs out. The function returns the bytes up to and including the CR and LF if it finds them in the string.
    3
    Immediate—Waits until the function receives any bytes from those you specify in bytes to read. Waits the full timeout only if the function receives no bytes. Returns the number of bytes so far. Reports a timeout error if the function receives no bytes.
    Otherwise, you need to follow the instructions per protocol;
    bytes to readis the number of bytes to read. Use one of the following techniques to handle messages that might vary in size:
    Send messages that are preceded by a fixed size header that describes the message. For example, it might contain a command integer that identifies what kind of message follows and a length integer that identifies how much more data is in the message. Both the server and client receive messages by issuing a read function of eight bytes (assuming each is a four byte integer), converting them into the two integers, and using the length integer to determine the number of bytes to pass to a second read function for the remainder of the message. Once this second read is complete, each side loops back to the read function of the eight byte header. This technique is the most flexible, but it requires two reads to receive each message. In practice, the second read usually completes immediately if the message is written with a single write function.
    Make each message a fixed size. When the content of a message is smaller than the fixed size you specify, pad the message to the fixed size. This technique is marginally more efficient because only a single read is required to receive a message at the expense of sending unnecessary data sometimes.
    Send messages that are strictly ASCII in content, where each message is terminated by a carriage return and linefeed pair of characters. The read function has a mode input that, when passed CRLF, causes it to read until seeing a carriage return and linefeed sequence. This technique becomes more complicated when message data can possibly contain CRLF sequences, but it is quite common among many internet protocols, including POP3, FTP, and HTTP.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

  • Sending binary data over RS232 without conversion to ascii

    I need to send binary data to a PIC without the data being converted to ascii. With the VISA vi's, when I want to send 11111111, it gets converted to a string "255", and is sent as "2","5","5" in ascii.
    How can I send it as one byte?

    r_keller wrote:
    @tbob: I probably shouldnt tell my customer that he's an idiot, and obviously 9 bit addressing/signalling modes seem to be not so uncommon in industry, so ur post does not really contribute to solve the problem.
    Well I wouldn't call my customer an idiot either.  I didn't know he was your customer.  Sorry.  Not every comment posted here is intended to directly solve a problem.  We are a fun loving group, and occasional ribbings take place here.  I still think that trying to use 9 bits over an 8-bit protocol is not a good way to go.  But if it is the only way, then so be it.
    r_keller wrote:
     Does the Mark or Space parity bit add another 10th bit to the command or can i only use either ODD parity/Mark/Space?
    According to the link you attached, the parity bit adds only one more bit.  If the number of bits is set to 8, then the parity is the 9th bit, and you can only use Mark or Space to force that 9th bit to either 1 or 0 respectively.  If you try to use odd or even parity, the protocol will determine the parity and change the bit accordingly, and it may not be the one you intended to send.  The start and stop bits are fixed by the protocol and cannot be used for extra data bits.
    Actually, until I read that article about using Mark and Space, I had no idea at all that sending 9 bits at a time was possible.
    - tbob
    Inventor of the WORM Global

  • Send multiple strings over TCP - Like messenger service

    Hello all Java Coders,
    I'm new with TCP programming.
    I'm beggining to learn about TCP and sockets connections in Java. In order to achieve this, I was coding a mini-program so I can learn a little bit about this.
    I'm trying to make a simple TCP program.
    The server sends a string to a client...
    I already searched for a couple of hours in google and so on, about what I'm doing wrong.
    [The server code (Just click)|http://pastebin.com/m39fd1273]
    [The client code (Just click)|http://pastebin.com/m57471803]
    I hope that someone can help me with this and, if you have patience, please tell me the reasons my code doesn't work.
    Many thanks,
    Freiheitpt
    P.S.: I think that the problem is on the server side...

    Sorry jverd.
    I was just trying to put things organized.
    Well, I can't get the String to be sent to the client.
    No error occurs.
    Server:
           try {
                srvr = new ServerSocket(1234);
                System.out.println("Connecting...");
                skt = srvr.accept();
                System.out.println("Connected!\nPreparing data exchange...");
                stream = skt.getOutputStream();
                out = new PrintWriter(stream, true);
                System.out.println("Done!\nReady to Send!");
            } catch (IOException ex) {
                System.out.println("Ups, didn't work!");
                System.exit(1);
            while(!data.equalsIgnoreCase("end")) {
                System.out.print("String to send: ");
                data = input.nextLine();
                System.out.print("Sending string: '" + data + "'\n");
                out.print(data);
            }Client:
            try {
                skt = new Socket("localhost", 1234);
                System.out.println("Connecting...");
                if (skt.isConnected()) {
                    System.out.println("Connected!\nPreparing data exchange...");
                    stream = skt.getInputStream();
                    inputStream = new InputStreamReader(stream);
                    in = new BufferedReader(inputStream);
                    System.out.println("Done!\nReady to Receive!");
                } else {
                    System.out.println("Server not available!\nExiting...");
                    skt.close();
                    System.exit(1);
            } catch (IOException ex) {
                System.out.println("Ups, didn't work!");
                System.exit(1);
            while (!data.equalsIgnoreCase("end")) {
                while(!in.ready()) {}
                data = in.readLine();
                System.out.println("Received String: '" + data + "'");
            }

Maybe you are looking for

  • Problem Downloading Extra GarageBand Loops

    Just bought a new iMac and ran into a problem downloading the extra greyed out loops. The issue occurred because I upgraded GarageBand through Software Update before downloading the extra files. After the upgrade Software Update no longer gives you a

  • How would I password protect the MAIL application?

    I have never used passwords - but what I wanted to do was put a password (somehow) on the MAIL application so that no one can use it but me - in other words, when I click the application, it asks for a password before turning on. I want this to happe

  • Clean way to De-register/De-commission the database with EBS from RAC/Cluster.

    Hi, We have a database with EBS on RAC. We are looking for Clean way to decommissioning the database from the cluster. We tried earlier, but when we again installed a fresh database on that server some how we had issues with the user oracle in cluste

  • What does the black screen with large exclamation point mean?

    I'm trying to edit, or even just select a photo in iPhoto, but can't get it to come up - just the black screen with a large exclamation point. What does that mean, and how do I get back control of my photos?

  • InDesign CC 2014 Not Working

    I don't understand why I can't use the software for InDesign CC 2014 when I paid for it. All I see is that I can look at tutorials. I have the student version.