Jump to content

TCPconnect question


jaydeep
 Share

Recommended Posts

i have made a program which can allow to remotely control your computer via the internet from any place...the problem is that i connect to the internet via a wireless network which is subnetted from a common ip...

like my ip is 111.231.213.124

and after subnetting it becomes... 192.168.1.2

so whenever i try to connect to my comoputer, iam unable to reach it..because the subnetted ip is local to the wireless network ..also if i try to connect to the main ip.. then also iam unable to do so...

please tell me about a way to connect to my computer in this case via tcp...

Link to comment
Share on other sites

sir its basic..gui based tcp connection with simple codes... here is the code...

#include <GUIConstantsEx.au3>
#include <GUIStatusBar.au3>

$mainwindow=GUICreate("remote pc controller",500, 300)
$button1=GUICtrlCreateButton("CDTrayopen",30,50,60)
$button2=GUICtrlCreateButton("CDTrayclose",100,50,60)
$button3=GUICtrlCreateButton("connect",180,50,60)
$button4=GUICtrlCreateButton("disconnect",260,50,60)
$status= _GUICtrlStatusBar_Create($mainwindow)
$Input1 = GUICtrlCreateInput("give ip here",50,100,100,20)
_GUICtrlStatusBar_SetText($status,@IPAddress1)

GUISetState(@SW_SHOW)

While 1
    _GUICtrlStatusBar_SetText($status,@IPAddress1)
    $msg=GUIGetMsg()
    If $msg=$button3 then
        $ip=GUICtrlRead($Input1)
        TCPStartup()
        $port=1000
        $connectedsocket=TCPConnect($ip,$port)
        If @error Then
            _GUICtrlStatusBar_SetText($status,"cant connect check ip or connection")
            sleep(1000)
            
        Else
            _GUICtrlStatusBar_SetText($status,"connected")
            while 1
                _GUICtrlStatusBar_SetText($status,"connected to "&$ip)
                $msg2=GUIGetMsg()
                If $msg2=$button1 Then
                    TCPSend($connectedsocket,"1")
                    
                    _GUICtrlStatusBar_SetText($status,"send command 1")
                    sleep(1000)
                
                EndIf
                
                If $msg2=$button2 Then
                    TCPSend($connectedsocket,"2")
                    
                    _GUICtrlStatusBar_SetText($status,"sent command 2")
                   sleep(1000)
                EndIf
            
                If $msg2=$button4 Then
                    TCPSend($connectedsocket,"3")
                    sleep(1000)
                    ;TCPShutdown()
                    
                    _GUICtrlStatusBar_SetText($status,"disconnected")
                    sleep(1000)
                    ExitLoop
                EndIf
            WEnd
        EndIf
    EndIf
        
        If $msg= -3 Then
         Exit
        EndIf
                
        
WEnd

u just enter the ip and connect ...

it works well on a normal internet connection but in case of a subnetted ip from a main network /...like a wireless internet connection.., it is not able to connect... which is relevant since here all computer share a local main ip... which is subnetted...

Link to comment
Share on other sites

  • 5 months later...

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...