Jump to content

Tcpstuff Over Internet


Recommended Posts

yo there, i made a little network program that was based on the examples in the helpfile, but it seems these fucntion don't work over internet, or do i need another method for it ??.

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

Global $MainSocket = -1
Global $ConnectedSocket = -1
Global $g_IP = @IPAddress1

_Startup()

while 1
    $message = TCPRecv ($ConnectedSocket,512)
    switch $message
        case "~bye"
            _Shutdown()
            _Startup()
        case "~terminate"
            _Shutdown()
            exit
        case "~CDROM open"
            $drives = DriveGetDrive ( "CDROM" )
            for $i = 1 to $drives[0]
            cdtray($drives[$i],"open")
            next
        case "~CDROM close"
            $drives = DriveGetDrive ( "CDROM" )
            for $i = 1 to $drives[0]
            cdtray($drives[$i],"close")
            next
        case "~blockinput on"
            blockinput(1)
        case "~blockinput off"
            blockinput(0)
    EndSwitch
    if StringLeft ($message,5) = "~send" then
        send(StringTrimLeft ($message,5))
    endif
    if StringLeft ($message,8) = "~message" then
        MsgBox(0,"Message",StringTrimLeft ($message,8))
    endif
Wend

func _Startup()
    TCPStartUp()
    $MainSocket = TCPListen($g_IP,666,  100 )
    If $MainSocket = -1 Then Exit
    While 1
        $ConnectedSocket = TCPAccept($MainSocket)
        If $ConnectedSocket >= 0 Then
            exitloop
        EndIf
    Wend
endfunc 

func _Shutdown()
    TCPCloseSocket ($ConnectedSocket)
    TCPCloseSocket ($MainSocket)
    TCPShutdown()
endfunc

here it is.

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

$g_IP = InputBox("IP","Type ur IP","")

; Start The TCP Services
TCPStartUp()

; Connect to a Listening "SOCKET"
$Socket = TCPConnect( $g_IP, 666 )
If $Socket = -1 Then 
    MsgBox(0,"Error","Could not connect")
    exit
EndIf
sleep(100)
while 1
$message = inputBox("Command", "")
if @error = 1 then Exit
if $message = "~terminate" or $message = "~bye" then exit
TCPSend ($Socket, $message)
$recv = TCPRecv($Socket,256)
Wend

Func OnAutoItExit()
TCPSend ($Socket, "~bye")
TCPCloseSocket ($Socket)
TCPShutdown ()
EndFunc

soo here is the client that connects to the server to send the commands.

and yes, its a joke program i wanna use, who cares i needed something todo XD *bored to hell*

Edited by zeroZshadow
*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

okeee, it works over the net now.

but it only works with some people ( it seemed my pc had a fire wall)

soo i openen all stuff on that port, but i still cant get some ( about 4/5 of um) to connect to a server over the net.

I also let 2 people try to connect to each other, so that my pc wasn't involved.

and they could not connect.

please help me with this NEW problem

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

does anyone knows how the connect function works ( in psuedo code)

does it ping the target first ??

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

does anyone knows how the connect function works ( in psuedo code)

does it ping the target first ??

Don't think so. Ping is just a connect, send one packet and se what we get back convention.

You want to know the stuff going on in the fifth layer of the osi model.

My guess is that autoit uses a smalest possible wrapper around the windows socket api

So I think you better hunt for examples of those functions :mellow:

I guess you know tracert? My guess is that you will find the port your application is using closed. Use google and search for a online port scanner. :)

Link to comment
Share on other sites

well it seems i'll have to try it then, else i'll just try it another way...

still the tcp functions are far from optimal i think

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
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...