Sign in to follow this  
Followers 0
Alexxander

Need help with Multiple TCP server

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



please stay away from arrays i hate them :D

 

  Then programming is not the field for you...

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

  Then programming is not the field for you...

yes i agree arrays is primary in programming but i believe that we can avoid arrays for a simple script like this right ?


Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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.

 

Share this post


Link to post
Share on other sites

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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  
Followers 0