Sign in to follow this  
Followers 0
MyEarth

TCP Client-Server

3 posts in this topic

#1 ·  Posted (edited)

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: 

#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

 

 

Edited by MyEarth

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I have see that thread before posting this, but don't have any GUI for client ( and no encryption for TCPRev / TCPSend ) so i don't know how to start with it :(

I need a script ot something to work on as i have say on the first post, if someone can provide it i'm gratefully, otherwise I'm sorry but certainly do not force anyone :D

Edited by MyEarth

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