Please what I am doing wrong?
import org.apache.tomcat.jni.*;
import java.util.*;
public class ExampleAPR {
public static void main(String[] args) {
try {
// Initialize APR library
Library.initialize(null);
// Create pool
long pool = Pool.create(0);
// Create socket
long s = Socket.create(Socket.APR_INET,
Socket.SOCK_STREAM,
Socket.APR_PROTO_TCP,
pool);
// Bind to port
long addr = Address.info(null,
Socket.APR_INET,
Integer.parseInt(args[0]),
0, pool);
Socket.bind(s, addr);
long ns = Socket.accept(s);
byte[] recchars = new byte[80];
Socket.recv(ns, recchars, 0, -1);
System.out.println(new String(recchars));
} catch(Exception e) {
e.printStackTrace();
}
}
}
execution throws these errors:
org.apache.tomcat.jni.Error: Invalid argument
at org.apache.tomcat.jni.Socket.accept(Native Method)
at ExampleAPR.main(ExampleAPR.java:28)
seems that accept doesn't like s argument
Any pointers?
Regards, francesc
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]