Example usage for java.net Socket sendUrgentData

List of usage examples for java.net Socket sendUrgentData

Introduction

In this page you can find the example usage for java.net Socket sendUrgentData.

Prototype

public void sendUrgentData(int data) throws IOException 

Source Link

Document

Send one byte of urgent data on the socket.

Usage

From source file:Main.java

License:asdf

public static void main(String args[]) throws Exception {
    Socket s = new Socket("internic.net", 43);
    InputStream in = s.getInputStream();
    OutputStream out = s.getOutputStream();
    String str = "asdfasdfasdf\n";
    byte buf[] = str.getBytes();
    out.write(buf);/*from  w w w.j  a va 2 s  .  com*/
    int c;
    while ((c = in.read()) != -1) {
        System.out.print((char) c);
    }

    s.sendUrgentData(1);

    s.close();
}