Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with DatagramSocket

5 views
Skip to first unread message

cze...@visiospace.com

unread,
Feb 1, 2001, 9:07:04 AM2/1/01
to
hi all,

I've got a problem with a java.net.DatagramSocket. It seems impossible
to create multiple socket with the same address (any) and port. I don't
know why it tries to Bind the socket, since it is for writing only (and
it's compulsory in that use). I need to have at least two sockets on
that port (one in Java, the other for the server). I succesfully create
n socket in C++ in the same app, but not in Java


java.net.BindException: Address already in use
at java.net.PlainDatagramSocketImpl.bind(Native Method)
at java.net.DatagramSocket.create(DatagramSocket.java:164)
at java.net.DatagramSocket.<init>(DatagramSocket.java:140)
at java.net.DatagramSocket.<init>(DatagramSocket.java:112)
at com.chris.IHM.IHM_demo.main(IHM_demo.java:50)


When I run the app on another PC it's OK.

How can I achieve this ?

Cyril ZEKSER
VISIOSPACE

cze...@visiospace.com

unread,
Feb 2, 2001, 3:41:37 AM2/2/01
to Duane Morse
Duane Morse a écrit :

> You can use the same socket for sending and receiving, so your software
> logic needs to understand that.

Thanks, I know that, but It wasn't the sense of my question.
What I want to do is to have the Java prog, and the C++ server, both using
the same port and address (local or Any). In c++ I can run many instances,
but not in JAVA. When the C++ server runs, Java hangs.

Cyril

0 new messages