Jump to content

Help me connect 2 pcs


Recommended Posts

Some one help me connect 2 pcs without LAN network. I wan't my pcs is server and some pcs other on internet is client and send data to its. I'm try TCP and UDP but this is good on LAN network but on internet its not work. example (my code):

#include <GUIConstantsEx.au3>
#include <Inet.au3>
;Opt('MustDeclareVars', 1)

;==============================================
;==============================================
;SERVER!! Start Me First !!!!!!!!!!!!!!!
;==============================================
;==============================================

UDPStartup()

; Bind to a SOCKET
;==============================================
$socket = UDPBind(_GetIP(), 65532)
If @error <> 0 Then Exit

While 1
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
        MsgBox(0, "UDP DATA", $data, 1)
    EndIf
    sleep(100)
WEnd

Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc
Link to comment
Share on other sites

Some one help me connect 2 pcs without LAN network. I wan't my pcs is server and some pcs other on internet is client and send data to its. I'm try TCP and UDP but this is good on LAN network but on internet its not work. example (my code):

#include <GUIConstantsEx.au3>
#include <Inet.au3>
;Opt('MustDeclareVars', 1)

;==============================================
;==============================================
;SERVER!! Start Me First !!!!!!!!!!!!!!!
;==============================================
;==============================================

UDPStartup()

; Bind to a SOCKET
;==============================================
$socket = UDPBind(_GetIP(), 65532)
If @error <> 0 Then Exit

While 1
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
        MsgBox(0, "UDP DATA", $data, 1)
    EndIf
    sleep(100)
WEnd

Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc
Are you or your clients by any chance behind some NAT with a non-routable address (i.e. 10.* or 192.168.*)? That would require some port forwarding at the router.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I don't known network working. In example of autoit use @ipaddress1 to TCP server listen. @ipsddress1 return 192.168.1.4 . I think it is LAN IP address but my script don't run in LAN network. I wan't connect 2 pcs in WAN network. But when I change IP in example my script don't work. You can teach me do it. thank you !

Link to comment
Share on other sites

I don't known network working. In example of autoit use @ipaddress1 to TCP server listen. @ipsddress1 return 192.168.1.4 . I think it is LAN IP address but my script don't run in LAN network. I wan't connect 2 pcs in WAN network. But when I change IP in example my script don't work. You can teach me do it. thank you !

That's a non-routable address. Either you or your ISP (or both) are employing Network Address Translation (NAT). Setting up a server in that environment is possible, but more complicated than I'm willing to get into on this forum. Try contacting your ISP's tech support, and Googling up more info on port forwarding.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...