Exemplo n.º 1
0
        private void pendingConnection_gotFileTransferId(object sender)
        {
            PendingViaConnection eventPvc = (PendingViaConnection)sender;

            Console.WriteLine("Pending Event! " + eventPvc.socket.RemoteEndPoint.ToString());
            int  i     = 0;
            bool found = false;

            for ( ; i < pendingViaConnections.Count && !found; i++)
            {
                PendingViaConnection pvc = (PendingViaConnection)pendingViaConnections[i];
                if (eventPvc.FileTransferId == pvc.FileTransferId)
                {
                    ViaConnection tempVia = new ViaConnection(pvc.socket, eventPvc.socket);
                    Console.WriteLine("Via Connection Established! \t" + eventPvc.socket.RemoteEndPoint.ToString() + '\t' + pvc.socket.RemoteEndPoint.ToString());
                    pendingViaConnections.RemoveAt(i);
                    found = true;
                }
            }
            if (found)
            {
                //	pendingViaConnections.RemoveAt(i);
            }
            else
            {
                pendingViaConnections.Add(eventPvc);
            }
        }
Exemplo n.º 2
0
 private void pendingConnection_gotFileTransferId(object sender)
 {
     PendingViaConnection eventPvc = (PendingViaConnection)sender;
     Console.WriteLine("Pending Event! " + eventPvc.socket.RemoteEndPoint.ToString());
     int i = 0;
     bool found = false;
     for( ; i < pendingViaConnections.Count && !found; i++)
     {
         PendingViaConnection pvc = (PendingViaConnection)pendingViaConnections[i];
         if(eventPvc.FileTransferId == pvc.FileTransferId)
         {
             ViaConnection tempVia = new ViaConnection(pvc.socket, eventPvc.socket);
             Console.WriteLine("Via Connection Established! \t" + eventPvc.socket.RemoteEndPoint.ToString() + '\t' + pvc.socket.RemoteEndPoint.ToString());
             pendingViaConnections.RemoveAt(i);
             found = true;
         }
     }
     if(found)
     {
     //	pendingViaConnections.RemoveAt(i);
     }
     else
     {
         pendingViaConnections.Add(eventPvc);
     }
 }