Jump to content

TCPRecv


Recommended Posts

Hi guys

from the examples i'm trying to Build a simple server so my client can connect to it

well i did that works good but looking at my server code it will only let 1 client connect

any ideas how icould get more then one client to connect ?

this is how my server works when i client connects to my server and types something the server then feeds it to the other clients .

but i can only get one client to connect would anyone know of a way i could get more then one to connect

thank you

michael

dim $ConnectedSocket

$g_IP = "127.0.0.1"

TCPStartUp()

$MainSocket = TCPListen($g_IP, 65431, 100 )

If $MainSocket = -1 Then Exit

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

If $ConnectedSocket >= 0 Then

TCPSend( $ConnectedSocket , "connected" )

Sleep(2000)

endif

;----------------------------------------------------------------------

$recv = TCPRecv($ConnectedSocket, 512 )

If $recv <> "" Then

TCPSend( $ConnectedSocket, $recv )

endif

Wend

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...