Bonsoir, je ne comprend pas pourquoi j'ai cette erreur :
<< Connection refused. No connection could be made because the target computer actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host—that is, one with no server application running. >>
Alors que j'essaye de me connecter au localhost :
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); // Creation socket : IPV4, stream, protcol use = TCP
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3405); // Point terminaison réseau avec adress (localhost) + port : 3405
try
{
socket.Connect(endPoint);
}
catch (SocketException ex)
{
Console.WriteLine("La connection n'a pu etre etablie. Pour connaitre la raison il faut regarder la propriete ErrorCode de l'exception");
Console.WriteLine("Erreur socket: " + ex.ErrorCode);
//References sur les codes erreurs: http://msdn.microsoft.com/en-us/library/ms740668%28VS.85%29.aspx
C'est vraiment étrange, je n'arrive pas à comprendre. Merci pour toutes aides.