Sign in to follow this  
Followers 0
2words4uready

[Resolved] TCP

12 posts in this topic

#1 ·  Posted (edited)

I've decided to jump into the Autoit world of TCP

1. What would be a good project to learn tcp?

2. Nothing too advanced.

Edited by 2words4uready

READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites



Maybe a remote command of some sort?

send a tcp packet and have the other side reply with a message box?

seems simple!


tolle indicium

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I thought this code Here was very helpful. I just started TCP stuff myself a few days ago and this was a great start point. Doing a simple telnet like server.

Edited by SoulA

Share this post


Link to post
Share on other sites

Could some one post an example of a simple tcp script that sends a message box to another computer?

I cant seem to figure the tcp out


READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites

Could some one post an example of a simple tcp script that sends a message box to another computer?

I cant seem to figure the tcp out

cant figure it out

my code so far

Server

while 1
TCPStartup()
$main = TCPListen(@ipaddress1, 1111)
TCPAccept($main)
If TCPRecv($main, 1000) = "{!}msg" Then
    MsgBox(0,"Test", "Message Sent")
EndIf
WEnd

Client

TCPStartup()
$ip = "72.171.0.147"
$msg = "{!}msg"
$socket = TCPConnect($ip, 1111)
TCPSend($socket, $msg)

I'm assuming my code is way off.

Any help would be appreciated.


READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites

u should remove the tcpstartup from loop

Share this post


Link to post
Share on other sites

Learn to send a TCP message that has a header describing the data. Interpret the header and act on the data.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

u should remove the tcpstartup from loop

code is still not working

READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites

Learn to send a TCP message that has a header describing the data. Interpret the header and act on the data.

Lar.

And how would i do this?

READ BEFORE POSTINGMy UDF'sMessagesYou say plz because its shorter than please. I say no because its shorter than yes.Join My Website

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Server

$ip = @ipaddress1;or "0.0.0.0" for all interfaces
$port = 1111
TCPStartup()
$main = TCPListen($ip, $port)
Do
        $socket = TCPAccept($main)
Until $socket <> -1
Do
        $recv = TCPRecv($socket, 17520)
Until $recv <> ""
    
If $recv = "msgbox" Then MsgBox(0,"Test", "Message Sent")
TCPCloseSocket($socket)
TCPShutdown()

Client

$ip = "72.171.0.147"
$port = 1111
$msg = "msgbox"
TCPStartup()
Do
         $socket = TCPConnect($ip, $port)
Until $socket <> -1
sleep(50)
TCPSend($socket, $msg)
If @error Then MsgBox(0,"Error", "Message Failed To send")
TCPShutdown()

Basic Idea not tested

Make sure if you test you have your firewall and what not set up to accept connections on whatever port you set for the server.

Edited by SoulA

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