@Override public int receive(NativeDatagramPacket p) { bsd_sockaddr_in in_addr = new bsd_sockaddr_in(); int[] szRef = new int[] { in_addr.size() }; ByteBuffer buf = p.getContent(); int n = recvfrom(getSock(), buf, buf.capacity(), 0, in_addr, szRef); p.setLength(n); p.setAddress(in_addr.getAddress()); p.setPort(in_addr.getPort()); return n; }
public BSDV4NativeSocket(final int family, final int type, final int protocol, final int listenPort) throws Exception { m_sock = socket(family, type, protocol); final bsd_sockaddr_in in_addr = new bsd_sockaddr_in(listenPort); bind(m_sock, in_addr, in_addr.size()); }
public void setPort(int port) { byte[] p = new byte[] {(byte)(0xff & (port >> 8)), (byte)(0xff & port)}; assertLen("port", p, 2); sin_port = p; } }
@Override public int receive(final NativeDatagramPacket p) { final bsd_sockaddr_in in_addr = new bsd_sockaddr_in(); final int[] szRef = new int[] { in_addr.size() }; final ByteBuffer buf = p.getContent(); final int socket = getSock(); SocketUtils.assertSocketValid(socket); final int n = recvfrom(socket, buf, buf.capacity(), 0, in_addr, szRef); p.setLength(n); p.setAddress(in_addr.getAddress()); p.setPort(in_addr.getPort()); return n; }
public BSDV4NativeSocket(final int family, final int type, final int protocol, final int listenPort) throws Exception { m_sock = socket(family, type, protocol); final bsd_sockaddr_in in_addr = new bsd_sockaddr_in(listenPort); bind(m_sock, in_addr, in_addr.size()); }
public void setPort(int port) { byte[] p = new byte[] {(byte)(0xff & (port >> 8)), (byte)(0xff & port)}; assertLen("port", p, 2); sin_port = p; } }
@Override public int receive(final NativeDatagramPacket p) { final bsd_sockaddr_in in_addr = new bsd_sockaddr_in(); final int[] szRef = new int[] { in_addr.size() }; final ByteBuffer buf = p.getContent(); final int socket = getSock(); SocketUtils.assertSocketValid(socket); final int n = recvfrom(socket, buf, buf.capacity(), 0, in_addr, szRef); p.setLength(n); p.setAddress(in_addr.getAddress()); p.setPort(in_addr.getPort()); return n; }
@Override public int send(NativeDatagramPacket p) { bsd_sockaddr_in destAddr = new bsd_sockaddr_in(p.getAddress(), p.getPort()); ByteBuffer buf = p.getContent(); return sendto(getSock(), buf, buf.remaining(), 0, destAddr, destAddr.size()); }
public void setPort(int port) { byte[] p = new byte[] {(byte)(0xff & (port >> 8)), (byte)(0xff & port)}; assertLen("port", p, 2); sin_port = p; } }
@Override public int send(final NativeDatagramPacket p) { final bsd_sockaddr_in destAddr = new bsd_sockaddr_in(p.getAddress(), p.getPort()); final ByteBuffer buf = p.getContent(); final int socket = getSock(); SocketUtils.assertSocketValid(socket); return sendto(socket, buf, buf.remaining(), 0, destAddr, destAddr.size()); }
public void setAddress(InetAddress address) { byte[] addr = address.getAddress(); assertLen("address", addr, 4); sin_addr = addr; }
@Override public int send(final NativeDatagramPacket p) { final bsd_sockaddr_in destAddr = new bsd_sockaddr_in(p.getAddress(), p.getPort()); final ByteBuffer buf = p.getContent(); final int socket = getSock(); SocketUtils.assertSocketValid(socket); return sendto(socket, buf, buf.remaining(), 0, destAddr, destAddr.size()); }
public void setAddress(InetAddress address) { byte[] addr = address.getAddress(); assertLen("address", addr, 4); sin_addr = addr; }
public void setAddress(InetAddress address) { byte[] addr = address.getAddress(); assertLen("address", addr, 4); sin_addr = addr; }