Hi

I tried to write an AprDatagramAcceptor and test it using the example.udp (MemoryMonitor) example by replacing the NioAcceptor with my AprAcceptor. In a fist step it seems to work when I use Socket.recv(), except that I need the sender's IP address which I don't get with a simple recv(). So I tried to use recvFrom() as shown in the code 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 the buffer...
            */
           byte b[] = new byte[buffer.capacity()];

           //initialize a new apr_sockaddr_t
           long ra = Address.info("123.123.123.123", 0, 0, 0, pool);

//use recvFrom() to read the datagram and fill in the apr_sockaddr_t with the remote address int bytesRecv = Socket.recvFrom(ra,handle,0,b,0,buffer.capacity()); //use recv() to just get the datagram into the buffer for further processing
           //int bytesRecv = Socket.recv(handle,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;
   }





What happens now is an UnsatisfiedLinkError as shown below:


UDPServer listening on port 18567
Exception in thread "pool-1-thread-2" java.lang.UnsatisfiedLinkError: org.apache.tomcat.jni.Socket.recvFrom(JJI[BII)I
   at org.apache.tomcat.jni.Socket.recvFrom(Native Method)
at org.apache.mina.transport.socket.apr.AprDatagramAcceptor.receive(AprDatagramAcceptor.java:240) at org.apache.mina.transport.socket.apr.AprDatagramAcceptor.receive(AprDatagramAcceptor.java:1) at org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor.readHandle(AbstractPollingConnectionlessIoAcceptor.java:398) at org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor.processReadySessions(AbstractPollingConnectionlessIoAcceptor.java:380) at org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor.access$4(AbstractPollingConnectionlessIoAcceptor.java:374) at org.apache.mina.core.polling.AbstractPollingConnectionlessIoAcceptor$Worker.run(AbstractPollingConnectionlessIoAcceptor.java:333) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


I am using the mina version from the repo (checked out last thursday) and the 1.1.14 version of tcnative-1 on a win32 (xp sp3) box...The AprSocketAcceptor seems to work fine here...Any ideas, what I could be missing?


cheers,
Lorenz

Reply via email to