Jump to content
Sign in to follow this  

Multi client server

Recommended Posts


Has anyone created a server which adcepts multiple clients using larry au3xtra.dll ?

A few months ago I was playing with the new Tcp function's Larry's DLL offered and altho I created quite a few client/server gui's I could never manage to get more than 1 client to connect to a server !

Ive been really busy latly and havnt been around much, but once again my intrest has been sparked by the idea of creating a multi client server !

I wish to make a handy network tool!

Has anyone got an sample code demonistrating a server that adcepts more than one client ??? that they would like to share ???

Share this post

Link to post
Share on other sites

I had one laying around. We lost power one night so i decided to mess with it on my laptop:P I tested it the next day and it worked fine on a network.

Ill see if i can find it laying around.


Share this post

Link to post
Share on other sites

where'd my post go? i posted a server 3+ hours ago.... well here it is the server doesn't forward messages to all clients or send anything but its here

#include <GUIConstants.au3>

DllCall("au3xtra.dll", "int", "TCPStartUp")

$MainSocket = DllCall("au3xtra.dll", "int", "TCPListen", "str", "", "int", 81, "int", 100)
If @error = 1 Then Error()
$MainSocket = $MainSocket[0]

Dim $Userlist
Dim $socket[1]
$socket[0] = 0

GUICreate("Server", 300, 300)
$Edit = GUICtrlCreateEdit(@TAB & @TAB & "Server started." & @CRLF, 0, 0, 300, 300)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    For $i = 1 To $socket[0]
        $ret = DllCall("au3xtra.dll", "int", "TCPRecv", "int", $socket[$i], "str", "", "int", 500)
        If $ret[0] > 0 Then
            GUICtrlSetData($Edit, GUICtrlRead($Edit) & @CRLF & $ret[2])
    $NewClient = DllCall("au3xtra.dll", "int", "TCPAccept", "int", $MainSocket)
    If Not @error And $NewClient[0] > 0 Then
        ReDim $socket[UBound($socket) + 1]
        $socket[0] = UBound($socket) - 1
        $socket[UBound($socket) - 1] = $NewClient[0]
        GUICtrlSetData($Edit, GUICtrlRead($Edit) & @CRLF & "New client.")
For $i = 1 To $socket[0]
    DllCall( "au3xtra.dll", "int", "TCPCloseSocket", "int", $socket[$i])
DllCall( "au3xtra.dll", "int", "TCPCloseSocket", "int", $MainSocket)
DllCall( "au3xtra.dll", "int", "TCPShutDown")

Func Error()
    MsgBox(16, "Error", "Cannot start server.")

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post

Link to post
Share on other sites

Tnx a million for your reply Xenogis,

Thats adsactly what I was looking for !!!

Im gona have fun editing this code to suit my needs !

You have given me a great start

Tnx again,


Share this post

Link to post
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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.