List of usage examples for java.net SocketOptions SO_BINDADDR
int SO_BINDADDR
To view the source code for java.net SocketOptions SO_BINDADDR.
Click Source Link
From source file:org.jnode.net.ipv4.tcp.TCPSocketImpl.java
/** * @see java.net.SocketOptions#getOption(int) *//*from w w w .j a va 2 s . com*/ public Object getOption(int option_id) throws SocketException { switch (option_id) { case SocketOptions.SO_BINDADDR: return controlBlock.getLocalAddress().toInetAddress(); case SocketOptions.SO_RCVBUF: return controlBlock.getReceiveBufferSize(); case SocketOptions.SO_SNDBUF: return controlBlock.getSendBufferSize(); case SocketOptions.SO_TIMEOUT: // todo implement it, 0 means disabled return 0; default: throw new SocketException("Option " + option_id + " is not recognised or not implemented"); } }
From source file:org.shelloid.netverif.NetVerifSocketImpl.java
@Override public void bind(InetAddress host, int port) throws IOException { InetAddress currHost = InetAddress.getByName(NetVerifEngine.getInstance().getCurrentHost()); this.setOption(SocketOptions.SO_BINDADDR, currHost); this.localport = port; System.out.println("bind: " + currHost + " port: " + port); }
From source file:org.shelloid.netverif.NetVerifSocketImpl.java
public void setOption(int optID, Object value) throws SocketException { if (optID == SocketOptions.SO_BINDADDR) { localAddr = (InetAddress) value; }//from w w w .jav a 2s . c o m }
From source file:org.shelloid.netverif.NetVerifSocketImpl.java
public Object getOption(int optID) throws SocketException { if (optID == SocketOptions.SO_BINDADDR) { return localAddr; } else// ww w. j ava2s . c om throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }