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

Java: Reading Textual Data using Socket

Java: Reading Textual Data using Socket

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);
            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) {

Users who found this page were searching for:

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

No comments yet.

Leave a Comment