Jump to content

Need help with Multiple TCP server


Recommended Posts

Hello every one 

i'm new to TCP

i am willing to learn networking with Autoit and making multi client servers

i found this awesome topic '?do=embed' frameborder='0' data-embedContent>>

 by mr.bogQ

but i found it too hard for me even a after i read his description multiple times 

so i decided to learn be trying 

i'm willing to make a simple local online availability checker

where i am the server and other local PCs are the clients

when i open the server script i see all the online PC in my networks

after struggling alone for 3 hours with TCP commands trying to make my script i made this

server

#include <GUIConstantsEx.au3>
TCPStartup()
$socket = TCPListen("192.168.1.111", 90)
GUICreate("new", -1, -1)
GUISetState()
$list = GUICtrlCreateList("", -1,-1,-1,-1)


While 1
$accept = TCPAccept($socket)
$recive = TCPRecv($accept, 1000000)
$recivename = StringSplit($recive, ":")
If $recivename[1] = "mynameis" Then GUICtrlSetData($list, $recivename[2])
If $recivename[1] <> "mynameis" Then GUICtrlSetData($list, "")
Sleep(1000)
WEnd

Func ext()
    Exit
EndFunc

client

TCPStartup()

While 1
$socket = TCPConnect("192.168.1.111", 90)
TCPSend($socket, "mynameis:" & @ComputerName)
Sleep(1000)
WEnd

Func ext()
    Exit
EndFunc

i know my code is very basic but for now i'm so proud to what i had achieved

my script is working for 1 client it cant deal with multiple clients at same time

i cant understand how to mix GUI with TCP when dealing with multiple clients

maybe if someone her can help me make my script a multiple clients supported

please stay away from arrays i hate them :D

please try to edit or direct me to edit my code i don't want examples from the internet this script is completely written by me

thanks in advanced

Edited by Alexxander

Link to comment
Share on other sites

  • Moderators

please stay away from arrays i hate them :D

 

  Then programming is not the field for you...

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

quick explanation of array is:

excel sheet where for 1d arrayes (array[nRow]) you have one column with n rows, every cell holds some data

or

excel sheet where for 2d arrayes (array[n][n]) you have n column with n rows, every cell holds some data

well you can try to avoid them, you do have Assing and Eval so try with them

but dont expect alot of help, for someone to understand what is worng with some code will need to understand your code, avoiding array is a big problem on complex things.

similar code with gui and array

and picture for it

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
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...