Locked udpclient socket help ?

  • Saturday, May 12, 2012 10:58 PM
     
     

    please help me to resolve this problem 

    i need to connect with udp client at @ 127.0.0.1 and the port 514 (syslog server)

    but when i compile my program this exception appears :

    <<<" Une exception non gérée du type 'System.Net.Sockets.SocketException' s'est produite dans System.dll
    Informations supplémentaires : Une seule utilisation de chaque adresse de socket (protocole/adresse réseau/port) est habituellement autorisée">>>

     i use c# language

    • Moved by Alexander Sun Monday, May 14, 2012 5:49 AM Move to more appropriate forum (From:Visual C# General)
    •  

All Replies

  • Sunday, May 13, 2012 12:34 AM
     
     
    What is the line that gives you this error?

    Marco Minerva [MCPD]
    Blog: http://blogs.ugidotnet.org/marcom
    Twitter: @marcominerva

  • Sunday, May 13, 2012 4:38 PM
     
     

    the line in my code :

    public void Receivepacket(param) {

    ......

    UdpClient udpcli = new UdpClient(514);// this line when error appears

    .....

    }

  • Sunday, May 13, 2012 6:05 PM
     
     
    The problem is the initialization itself. You already have a program on your computer running which bound a socket to the port 514. Therefore this port is used. When you want to connect to that port you need to bind the port in the client application to another port and use this socket to connect to port 514.