Jump to content

Recommended Posts

Posted

maybe i didnt seach the right phrase but i have a few quick questions;

1.how manny virtual sockets can one computer handle?

2.how do you check if a socket in a multiclient TCP is empty?

thank you

Posted

maybe i didnt seach the right phrase but i have a few quick questions;

1.how manny virtual sockets can one computer handle?

2.how do you check if a socket in a multiclient TCP is empty?

thank you

try this Global $CurrentSocket = 0
Global $ListenSocket
Global $ConnectedSocket[16]

$TCP = TCPStartup()
If $TCP = 0 Then
    MsgBox(0, "Error", "Unable to startup TCP Services!")
    Exit
EndIf

$ListenSocket = TCPListen(@IPAddress1,1777,16)
If $ListenSocket = -1 Then
    MsgBox(0, "ERROR", "Unable to start listening on port 1777")
    Exit
EndIf
  
While 1
    $ConnectedSocket[$CurrentSocket] = TCPAccept($ListenSocket)
    If $ConnectedSocket[$CurrentSocket] <> -1 Then
        $CurrentSocket = $CurrentSocket + 1
    EndIf
    For $INDEX = 0 To 15
        If $ConnectedSocket[$INDEX] <> -1 Or $ConnectedSocket[$INDEX] <> "" Then
            $Recv = TCPRecv($ConnectedSocket[$INDEX],1024)
            If $Recv <> "" Then
            ...
            EndIf
        EndIf
    Next
    Sleep(20)
WEnd
Posted

hmm ill take a look into that later, i got stuff to do now :) thank you for responding

and the question #2? anyone know how many virtual sockets there are? or what?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...