Sign in to follow this  
Followers 0
felixli93

Sending Data via Internet between 2 PCs

3 posts in this topic

hi,

i want to make kinda instantmessenger between two computers (my friend's and mine)

what do I have to do?

So this works just fine:

Receiving:

UDPStartup()

$ip = @IPAddress1
$socket = UDPBind($ip, 80)

While 1
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
    TrayTip("Incoming Data", "Incoming Data: ''"&$data&"''", 5)
    EndIf
    sleep(100)
WEnd

Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc

Sending:

Opt ("OnExitFunc","_CloseService")

UDPStartup()
$IP =  @IPAddress1
$socket = UDPOpen($IP, 80)
    

$data = InputBox ("What to send?","What do you want to send?","this is a test")
   
$success = UDPSend($socket, $data)

If Not $success Then
    MsgBox(16, "ERROR", "Error while sending UDP message: " & @error)
    UDPCloseSocket($socket)
    UDPShutdown()
    Exit
Else
    MsgBox (64,"Success","Data sent!")
EndIf

Exit

Func _CloseService ()
    UDPCloseSocket ($socket)
    UDPShutdown ()
EndFunc

this works just fine,

now I want to send data between 2 different computers

how do I do that?

tried to just change $ip to the IP given by WhatIsMyIp.com

but this doesn't work; the @error then returns an error code given by the WINApi, and the array socket doesn't return anything but -1 in subscript [0]

Pls help me!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You are probably getting blocked by a firewall either at the sending, receiving or isp.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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