Bonjour,
Je fais un client ftp pour winCE (donc pas de ftpWebRequest). Il faut que mon client fasse des requêtes en mode actif.
Voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
foreach (string s in LOCALIP.Split('.'))
        {
          portData += s + ',';
        }
        port = rnd.Next(6000, 7000);
        port1 = port / 256;
        port2 = port % 256;
        portData += port1.ToString() + "," + port2.ToString();
        SendCommand("PORT " + portData, "200");
        tmp = lastResponse;
 
 
        dataSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        IPAddress adress = Dns.GetHostEntry(host).AddressList[0];
        IPEndPoint ep = new IPEndPoint(adress, port + 1);
 
        dataSocket.Bind(ep);
        dataSocket.Listen(10);
 
        SendCommand("RETR AFR-TESTG.dnc", "NOTEST");
        dataSocket.Receive(buffer, buffer.Length, 0);
Mais ça plante sur le dataSocket.Receive.

Une requête d'envoi ou de réception de données n'a pas été autorisée car le socket n'est pas connecté et (lors de l'envoi sur un socket datagramme en utilisant un appel sendto) aucune adresse n'a été fournie
Je ne vois pas de quel côté est mon erreur....