Results 1 to 2 of 2
  1. #1
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default Socket and how to launch thread for receiving socket messages

    Hello All,

    I am new to Java and I am writing socket programming, how to launch thread for receiving message?
    please help

    thanks & regards
    newbiejava

    Java Code:
    import java.util.StringTokenizer;
    import java.net.Socket;
    
    StringTokenizer st = new StringTokenizer(this.jTextField1.getText(),":");
    
    String ip = st.nextToken();
    int port = Integer.parseInt(st.nextToken());
    
    try {
            socket = new Socket(ip, port);
    } catch (UnknownHostException ex) {
    
    } catch (IOException ex) {
    
    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

Similar Threads

  1. Replies: 7
    Last Post: 06-22-2010, 11:49 AM
  2. Byte Array sending and receiving using Socket
    By venkateshcoolmoon in forum Networking
    Replies: 3
    Last Post: 01-23-2010, 08:34 PM
  3. best way to signal a thread that's blocking on a socket receive
    By danieru in forum Threads and Synchronization
    Replies: 5
    Last Post: 09-08-2009, 05:47 PM
  4. append response to the request from Socket and write to another socket
    By vaibhav_singh_vs@yahoo.co in forum Networking
    Replies: 3
    Last Post: 04-17-2009, 08:02 PM
  5. Receiving Text over a Socket (ReadLine() problem)
    By HermanHope in forum New To Java
    Replies: 1
    Last Post: 04-09-2009, 11:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •