Java examples for Network:Socket
Writing Text to a Socket
import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.Socket; public class Main { public static void main(String[] argv) { try {/* w w w. ja v a 2 s .c o m*/ Socket socket = null; BufferedWriter wr = new BufferedWriter(new OutputStreamWriter( socket.getOutputStream())); wr.write("aString"); wr.flush(); } catch (IOException e) { } } }