Jump to content

Sending Data via Internet between 2 PCs


Recommended Posts

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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...