Glad I could help ;) Maybe somebody can give me a hint now. I am trying to retrieve the port of the sender of a datagram using recvfrom() as shown below:
protected SocketAddress receive(Long handle, IoBuffer buffer) throws Exception { /*initialize a new byte array for now. Is the data correctly transferred to the * MINA framework like this? There must be some way to write directly to buffer... */ byte b[] = new byte[buffer.capacity()]; //initialize a new apr_sockaddr_t long ra = Address.info("123.123.123.123", 0, 14, 0, pool); //use recFrom() to read the datagram and fill in the apr_sockaddr_t with the remote address int bytesRecv = Socket.recvfrom(ra,(long) handle,0,b,0,buffer.capacity()); //move the acquired data to the buffer used in the future. Performance problem, there must be a direct way to do this buffer.put(b); //fill in the data to return (remote address) SocketAddress sa = new InetSocketAddress(Address.getip(ra), Address.getInfo(ra).port); return sa; } Now data seems to be correctly received, and Address.getip(ra) returns the correct IP address, however the port passed to the constructor of InetSocketAddress is always the one used during the initialization of the apr_sockaddr_t. Hence the port is either not fetched during the underlying native call to recvfrom, or incorrectly fetched in the getInfo() call, or I have made a mistake somewhere. Has anybody used these methods successfully before? Cheers, Lorenz --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]