UDP - NotYetConnectedException

fps fred.soulier.ml at gmail.com
Fri Jan 8 10:21:28 EST 2010


Hi

I've got a server running using Netty and UDP (NIO).
I can send a simple UDP packet to the server which is received and processed
correctly. Part of the processing send a reply to the client but when
sending the reply I get a NotYetConnectedException...


java.nio.channels.NotYetConnectedException
	at sun.nio.ch.DatagramChannelImpl.write(DatagramChannelImpl.java:378)
	at
org.jboss.netty.buffer.HeapChannelBuffer.getBytes(HeapChannelBuffer.java:119)
	at
org.jboss.netty.channel.socket.nio.NioDatagramWorker.writeNow(NioDatagramWorker.java:523)
	at
org.jboss.netty.channel.socket.nio.NioDatagramWorker.write(NioDatagramWorker.java:457)
	at
org.jboss.netty.channel.socket.nio.NioDatagramPipelineSink.eventSunk(NioDatagramPipelineSink.java:112)
	at org.jboss.netty.channel.Channels.write(Channels.java:608)
	at org.jboss.netty.channel.Channels.write(Channels.java:569)
	at
com.jitty.proxy.server.handlers.MyEncoder.writeRequested(MyEncoder.java:39)

My client is non-Netty and pretty simple:
   ds = new DatagramSocket();
   ds.connect("127.0.0.1", 50000);
   byte[] send = ...
   ds.send(new DatagramPacket(send, send.length));
   // then wait for udp packet from server
   byte[] receive = new byte[1400];
   ds.receive(new DatagramPacket(receive, receive.length));

Why do you I get this NotYetConnectedException when replying to a client
that has just sent a message.?

Note that I have the same processing over TCP (NIO) which works great.

Thx
Frederic
-- 
View this message in context: http://n2.nabble.com/UDP-NotYetConnectedException-tp4273120p4273120.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list