[4787] in java-interest

home help back first fref pref prev next nref lref last post

Re: Help needed with UDP-client & server

daemon@ATHENA.MIT.EDU (Kevin Conner)
Sun Jan 14 10:42:30 1996

Date: Sun, 14 Jan 1996 14:17:28 +0000
From: Kevin Conner <knrc@impltd.com>
To: Tim Moons <tim@innet.be>
Cc: java-interest@java.sun.com


Hiya Tim.

Did you get an answer to this problem?

If not this might help you.  I found two problems with this,
one in the Server class and another in the UDPClient class.

The server class tries to set up a DatagramPacket but provides
an uninitialised buffer as the first parameter.  Add a line
to your code like the following

    ibuf = new byte[256] ;

The problem in UDPClient occurred because I ran both programs
on the same machine.  Your connect function tries to create a
DatagramSocket with port 7000, this will have already been taken
by the server.  It may be a better idea to replace this with
a default port instead of an explicit one, e.g.

    client = new DatagramSocket() ;

I hope this helps,
	Kev

-----------------------------------------------------------------------
Kevin Conner          knrc@impltd.com         Integrated Micro Products
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post