Best Mmorpg/Rpg Forum whit tutorials
Doriti să reactionati la acest mesaj? Creati un cont în câteva clickuri sau conectati-vă pentru a continua.
Best Mmorpg/Rpg Forum whit tutorials

Cel mai bun Forum cu cele mai bune Tutoriale
 
AcasaAcasa  CăutareCăutare  Ultimele imaginiUltimele imagini  ÎnregistrareÎnregistrare  Conectare  

 

 Multi connection port

In jos 
AutorMesaj
alex
Profesionist
Profesionist
alex


Numarul mesajelor : 132
Varsta : 32
Location : Terra
Data de inscriere : 20/10/2007

Multi connection port Empty
MesajSubiect: Multi connection port   Multi connection port EmptyJoi Oct 25, 2007 8:49 pm

Adaugatzi urmatoru modul

Cod:

Option Explicit
Public Const ListenPort = 3535
Public Const ConnectionNr = 300
Public EmptyOrFull(ConnectionNr) As Boolean
Public Function Accept() As Boolean
On Error Resume Next
Dim x As Integer
For x = 1 To ConnectionNr
Load frmMain.sock(x)
Next x
Accept = True
Exit Function
Accept = False
End Function
Public Function GetNew() As Integer
On Error Resume Next
Dim x As Integer
For x = 1 To ConnectionNr
If EmptyOrFull(x) = False Then
GetNew = x
Exit Function
End If
Next x
GetNew = 0
End Function
Adaugatzi pe forma 2 winsockuri cu numele sock si sock2.Punetzi urmatorul cod pentru ele

Cod:
Private Sub sock2_ConnectionRequest(ByVal requestID As Long)
Dim aFreeSocket As Integer
aFreeSocket = GetNew
If aFreeSocket = 0 Then
sock(0).Accept requestID
DoEvents
sock(0).Close
Else
EmptyOrFull(aFreeSocket) = True
sock(aFreeSocket).Accept requestID
End If
End Sub
Private Sub sock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim sData As String
sock(Index).GetData sData
End Sub
Private Sub sock_Close(Index As Integer)
EmptyOrFull(Index) = False
End Sub
Sus In jos
 
Multi connection port
Sus 
Pagina 1 din 1

Permisiunile acestui forum:Nu puteti raspunde la subiectele acestui forum
Best Mmorpg/Rpg Forum whit tutorials :: Diverse :: Propriile Tutoriale-
Mergi direct la: