AHKSock Implementation (TCP for AHK)

Post your working scripts, libraries and tools
User avatar
goldeneyesrj
Posts: 33
Joined: 18 Jan 2016, 22:09
Location: Rio de Janeiro / Brazil

AHKSock Implementation (TCP for AHK)

05 Apr 2016, 13:24

My example for implementation of AHK_Sock.
EDIT: I make some modifications in TCPRECEIVE function to have more precision.
EDIT 2: I update the code (Server and Client) with more layer to check errors. Maybe you like a variable only for control. A fixed string to determine if the inbound is valid. For example a acess password for connect... Any sugestion?
EDIT 3: Maybe you prefer to use another separator for variables... For example: ¤ or ¥ (i use this). Change all | by another character.

See:
https://autohotkey.com/board/topic/53827-ahksock-a-simple-ahk-implementation-of-winsock-tcpip/
Download AHKsock.ahk from top of first post (TheGood's) and paste in your \Documents\AutoHotkey\Lib folder.
PS.: the lib need AHK Unicode! Tested in Windows 10 Home SL, Home and Pro 1511 and 1607 x86 and x64.

Sorry for my bad english please.

Server:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Client: (the only diference is manual input of server address)

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by goldeneyesrj on 06 Jan 2017, 02:42, edited 2 times in total.
User avatar
goldeneyesrj
Posts: 33
Joined: 18 Jan 2016, 22:09
Location: Rio de Janeiro / Brazil

Re: AHKSock Implementation (TCP for AHK)

31 Dec 2016, 15:31

I change the TCP Receive function.
This is the version i use in my scripts.

Atention in this line (server and Client):

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

if A_Index= 4 ;IF NUMBER OF VARS + 1 (`n POSITION)


You have to put a number of vars transmited for other part plus one!
In the example, 3 vars + 1 is 4

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

if A_Index= 1
TEXT4= %A_LoopField%
if A_Index= 2
TEXT5= %A_LoopField%
if A_Index= 3
TEXT6= %A_LoopField%


Sorry my bad english.
DanielToward13
Posts: 35
Joined: 18 May 2017, 10:56

Re: AHKSock Implementation (TCP for AHK)

30 Jul 2017, 17:28

Does it work over the internet?
is there a way to create a P2P connection without changing the firewall and routing settings?
User avatar
goldeneyesrj
Posts: 33
Joined: 18 Jan 2016, 22:09
Location: Rio de Janeiro / Brazil

Re: AHKSock Implementation (TCP for AHK)

23 Sep 2017, 09:55

DanielToward13 wrote:Does it work over the internet?
is there a way to create a P2P connection without changing the firewall and routing settings?


I never tested over internet, but maybe you need to create a desmilitarized zone in your router to expose your computer to internet, same way dvrs security cameras. First test in diferents subnets... Sorry my bad english.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 26 guests