hi guys can somebody give me a hint on how to send a udp message from a specific port using the jni (or directly the apr) code? i am trying the following:
long handle = Socket.create(Socket.APR_INET, Socket.SOCK_DGRAM, Socket.APR_PROTO_UDP, pool); Socket.optSet(handle, Socket.APR_SO_NONBLOCK, 1); Socket.timeoutSet(handle, 0); InetSocketAddress la = (InetSocketAddress) localAddress; long sa; if (la.getAddress() == null) { sa = Address.info(Address.APR_ANYADDR, Socket.APR_INET, la.getPort(), 0, pool); } else { sa = Address.info(la.getAddress().getHostAddress(), Socket.APR_INET, la.getPort(), 0, pool); } Multicast.hops(handle, ttl); Socket.bind(handle, sa); Socket.connect(handle, remoteAddress); If I leave out the bind part and just connect the socket to the remote address (in this case also on localhost) it works fine, everything works fine, however as soon as i do the bind() first followed by the connect(), it looks like the message is no longer received by the receiver (on the same machine)... any caveats i am missing? wireshark lists the udp packet, even with a "good" source port if i set the local address port to 0, so it may be sent, but then why is it not received if i send to the same address as before without the bind()?? or is it not sent after all? but then why would wireshark list the datagram? does anybody have an idea, where i could be going wrong? should i ask such questions on the users list? cheers, lorenz --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]