Example usage for java.net Socket setOOBInline

List of usage examples for java.net Socket setOOBInline

Introduction

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

Prototype

public void setOOBInline(boolean on) throws SocketException 

Source Link

Document

Enable/disable SocketOptions#SO_OOBINLINE SO_OOBINLINE (receipt of TCP urgent data) By default, this option is disabled and TCP urgent data received on a socket is silently discarded.

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);//  w w  w . ja  va2s.  co  m
    int c;
    while ((c = in.read()) != -1) {
        System.out.print((char) c);
    }

    s.setOOBInline(true);
    System.out.println(s.getOOBInline());

    s.close();
}