Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

TCP Client-Server

$
0
0

Hello community :D

I know this isn't the best way to start a thread and i'm apologize for this.

The forum is full of tons of TCP-UDP Chat but the example are all for expert, with many features, nothing for beginner like me so i don't know how to start, usually i'm learning directly from a script for develop another one.

I need a simple client-server chat for talking with my brothers and sisters (four in total :Dwho are far from home for long time for various reasons. I'm searching for only 2 feature:

- The message will be crypted over the net and decrypted by the client, security first

- A list of user on the right hand, updated, for know how is connected or not

That's all and nothing else.

 

I have made only the GUI client: 

AutoIt         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Global $UserName Settings() Func Settings()     $hSettings = GUICreate("Option Client", 180, 100, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))     $hIP = GUICtrlCreateInput(@IPAddress1, 12, 13, 100, 21, 1)     $hPort = GUICtrlCreateInput("50", 118, 13, 50, 21, 1)     $hUser = GUICtrlCreateInput("Username", 12, 39, 156, 21, 1)     $hConnect = GUICtrlCreateButton("Connect", 12, 66, 100, 20)     $hExit = GUICtrlCreateButton("Exit", 117, 66, 50, 20)     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE, $hExit                 Exit             Case $hConnect                 $UserName = GUICtrlRead($hUser)                 Client()         EndSwitch     WEnd EndFunc   ;==>Settings Func Client()     $hClient = GUICreate("Client", 493, 371, -1, -1)     $hEdit_Box = GUICtrlCreateEdit("", 8, 8, 329, 316, $ES_READONLY + $WS_VSCROLL + $ES_AUTOVSCROLL)     $hEdit_UserChat = GUICtrlCreateList("", 344, 8, 137, 316, $ES_READONLY)     $hInput_Message = GUICtrlCreateInput("Write here...", 8, 336, 393, 21)     $hButton_Send = GUICtrlCreateButton("SEND", 408, 336, 75, 22)     Local $AccelKeys[1][2] = [["{ENTER}", $hButton_Send]]     GUISetAccelerators($AccelKeys)     GUICtrlSetData($hEdit_Box, ">>>SERVER: " & $UserName & " has connected" & @CRLF) ; example     GUICtrlSetData($hEdit_UserChat, $UserName) ; example     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit             Case $hButton_Send                 If GUICtrlRead($hInput_Message) <> "" Then                     GUICtrlSetData($hEdit_Box, GUICtrlRead($hEdit_Box) & $UserName & " say: " & GUICtrlRead($hInput_Message) & @CRLF) ;example                     GUICtrlSetData($hInput_Message, "") ;example                 EndIf         EndSwitch     WEnd EndFunc   ;==>Client

I wish you once again my apologies for this "request""and I thank whatever the help that you give me.

Have a nice evening

 

 

 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>