Code example for SocketChannel

Methods: socket

0
	private void setIPAddress( SocketChannel sc )
	{ 
		_addr="Unknown";
		if(sc==null)
			return; 
		InetSocketAddress remoteSocketAddress = (InetSocketAddress) sc.socket().getRemoteSocketAddress();
		_fullAddr=remoteSocketAddress.toString();
		_addr=remoteSocketAddress. getHostName().toString();
	} 
 
	public String getAddr() {
		return _addr;
	} 
	/** 
	 * @see java.lang.Object#hashCode() 
	 */ 
	@Override 
	public int hashCode() { 
		final int prime = 31;
		int result = 1;
		result = prime * result + ((_pId == null) ? 0 : _pId.hashCode());