Sign in to follow this  
Followers 0
Marlo

Some TCP Connections

2 posts in this topic

Hello guys! :) I'm currently in the process of designing a Remote Administration Suit (Will release it when im done) and i just need a little bit of advice concerning TCP and data transfere.

I am using Kips TCP Event Driven UDP to run my TCP function and i have the following setup for the user side:

#include <TCP.au3> ;Kips UDF

Global Const $_HANDSHAKE = "a"
Global Const $_PASSWORD = "b"

_TCP_Server_Create($iPort)
_TCP_RegisterEvent($TCP_NEWCLIENT, "_NewConnection")
_TCP_RegisterEvent($TCP_DISCONNECT, "_ServerLost")
_TCP_RegisterEvent($TCP_RECEIVE, "_DataReceived")

While 1
    Sleep(50)
WEnd

Func _NewConnection($hSocket, $iError)
    ;a client has connected
EndFunc

Func _ServerLost($hSocket, $iError)
    ;a client has disconnected
EndFunc

Func _DataReceived($hSocket, $iError, $sReceived)
    ;sReceived is the string received from the client
    ;I use the first character in the string as a Command so the server can tell
    ;what type of data its just received. 
    Local $iCmd = StringLeft($sReceived, 1)
    Local $sParam StringMid($sReceived, 2)
    
    Switch $iCmd
        Case $_HANDSHAKE
            ;Server is saying hello
        Case $_PASSWORD
            ;server has sent us a password
    EndSwitch
EndFunc

The server has pretty much the same setup.

Now my questions are:

Could i improve on the way the server and client communicate? the _DataReceived() function is the best method i could come up with.

How would i use this method to get the servers ping? (will be having more than one server conencted at a time)

How would i use this method for file transferes?

Should i convert my data to binary before transmitting it?

If my explanation of my problems arnt clear just say and i'll try my hardest to explain it better.

Thanks in advanced

~Marlo


Click here for the best AutoIt help possible.Currently Working on: Autoit RAT

Share this post


Link to post
Share on other sites



Check this out and see if it gives you some guidance. Larry's kindofan all-star.

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