Jump to content

TCP chat only works in Network


alexxh
 Share

Recommended Posts

Hi there,

I've copied a script:

#include <GUIConstantsEx.au3>

;your IP
$Ip = "127.0.0.1"
$Port = 3000

;the other IP
$Ip2 = "127.0.0.1"
$Port2 = 3000

TCPStartUp ()
$Server = TCPListen($Ip,$Port,1)

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Chat", 625, 445, 192, 124)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 505, 265)
$Input1 = GUICtrlCreateInput("", 64, 336, 401, 21)
$Button1 = GUICtrlCreateButton("Send", 488, 336, 97, 25, 0)
$Button2 = GUICtrlCreateButton("X", 592, 0, 25, 17, 0)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $Client2 = TCPConnect ($Ip2,$Port2)
            TCPSend ($Client2, GUICtrlRead($Input1))
            ControlClick ("","",$Edit1)
            Send("-> " & GUICtrlRead($Input1),1)
            Send(" {Enter}",0)
        Case $Button2
            Exit
    EndSwitch
    
        $Client = TCPAccept($Server)
    If $Client >= 0 Then
        Do
            $Message = TCPRecv($Client,2048)
        Until $Message <> ""
        ControlClick ("","",$Edit1)
        Send("-> " & $Message,1)
        Send(" {Enter}",0)
    EndIf
WEnd

but it only works, when you run the script in a network.

What can I do, to use it through the Internet?

Which of these functions, do I have to use to find my IP?

GetIP()
@IPAdress1

Thx, Alex

sorry for my bad english xD

Link to comment
Share on other sites

Well, after you got youre thread closed because of your rude behaviour towards other members in the german autoit forum, you're trying it here, huh?

As I already told you in the german forum, check if the ports are open first. Since you don't know, how to do that, you should prolly read your routers manual. Also you can check for blocked ports in your firewall. I am pretty sure it also has an user-manual.

Best Regards, SEuBo

Link to comment
Share on other sites

http://translate.google.de/translate?js=y&prev=_t&hl=de&ie=UTF-8&layout=1&eotf=1&u=http%3A%2F%2Fautoit.de%2Findex.php%3Fpage%3DThread%26threadID%3D16545&sl=de&tl=en

Same Script, Same question. Besides that alexxh94 has 0 posts and registered today. So try to make fun out of someone else.

Link to comment
Share on other sites

alexxh, I do not believe you.... any idea why?

Having run forums myself in the past...

owners (and moderators if allowed) have such privy information like...

IP addresses of members...

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

  • Developers

Having run forums myself in the past...

owners (and moderators if allowed) have such privy information like...

IP addresses of members...

sure, but I am only active on this forum, not the German one.

To be honest I doubt if I need to seek any confirmation.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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