Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Socket Programming Java

  • 03-05-2005 02:02PM
    #1
    Closed Accounts Posts: 375 ✭✭


    DatagramSocket Socket = new DatagramSocket(34396);
    byte[] buffer = Transmission.getBytes();
    InetAddress IP = InetAddress.getByName(Source);
    DatagramPacket Packet = new DatagramPacket(buffer, buffer.length, IP, 5060);
    Socket.send(Packet);

    I have the above code and I'm, having a little trouble for some reason I get the following error

    java.net.BindException: Address already in use
    at java.net.PlainDatagramSocketImpl.bind0(Native Method)
    at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82)
    at java.net.DatagramSocket.bind(DatagramSocket.java:368)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:210)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:261)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:234)
    at SipProxy.UseMess.OK(UseMess.java:153)
    at SipProxy.UseMess.Register(UseMess.java:51)
    at SipProxy.NetworkListener.run(NetworkListener.java:52)
    at java.lang.Thread.run(Thread.java:595)

    even if I change the port number, it seems to be the DatagramSocket line that cause this, This works perfectly at home so I'm not sure if it's a network issue? any help would be greatly appreciated!

    Regards
    Michael


Advertisement