Sign in to follow this  
Followers 0
AutoITphil

Creating An Instant Messenger

1 post in this topic

Hello fellow coders of AutoIT. I am extremely new to this concept of "networking". And I couldn't really seem to find anything helpful on the forums about what I am trying to do (it was mostly just people getting flamed for asking a question similar to mine). I am trying to make an Instant Messenger. I'll probably want to sit down one day and create a fancy GUI for it, but right now I just want to get the networking part down. Msgbox's would be a perfectly could substitute for now. But now how do I do this networking part? I have created two scripts, a server and a client, that must both be run for it to work. I was hoping to consolidate these into one. But the biggest problem I have with AutoIT is the lack on multitasking. Here are those two scripts:

Client:

#include <misc.au3>

func IM()
$input = InputBox("The IM", "Your message please")

TCPStartup()

$TCPconnect = TCPConnect(@IPAddress1, 403)

if $TCPconnect = -1 then Exit

TCPSend($TCPconnect, $input)
EndFunc

$exit = 1

while $exit < 3
    IM()
    if _IsPressed("45") then $exit = 4
WEnd

And the Server:

#include <misc.au3>

func Server()
TCPStartup()

$TCPListen = TCPListen(@IPAddress1, 403)
Do
    $TCPAccept = TCPAccept($TCPListen)
Until $TCPAccept <> -1

do
    $TCPRecv = TCPRecv($TCPAccept, 1000)
until $TCPRecv <> ""
sleep(300)
MsgBox(0,"The Message", $TCPRecv)
TCPShutdown()
EndFunc

$ExitSer = 1

while $ExitSer < 3
    Server()
    if _IsPressed("45") then $ExitSer = 4
WEnd

Please help me out with this, it will be greatly appreciated :x

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