Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: Reading Textual Data using Socket

Java: Reading Textual Data using Socket
{filelink=231}

import java.net.*;
import java.io.*;
public class SocketReader
{
    public static void main(String[] argv) {
        String address= "localhost";
        try {
            Socket sock = new Socket(address, 2004);
r
            BufferedReader is = new BufferedReader(new
                InputStreamReader(sock.getInputStream( )));
            // Read String data
            String data = is.readLine( );
            System.out.println("The server on " + address + " says " + data);
        } catch (IOException ex) {
            System.err.println(ex);
        }
    }
}

Users who found this page were searching for:

  • perl smtplib def sendmail
  • finding/reading a file using socket java
  • java socket read header and data
  • python read binary
  • a program in java to display a dictionary using sockets and threads
  • interate over tuple python
  • how to use calendar class java
  • python characters list

No comments yet.

Leave a Comment