gononono64 Posted May 5, 2010 Share Posted May 5, 2010 Goal: My goal is to create (eventually) a msn type chat. Problem: i cant figure out how to connect over the internet... i can only connect through my router Code: Server: global $connectedsocket $ip = @IPAddress1 $port = 65432 ;to start tcp services TCPStartup() ;create listening socket $mainsocket = TCPListen($ip, $port) If $mainsocket = -1 Then Exit ;Accept incoming clients and recieve info While 1 $connectedsocket = TCPAccept($mainsocket) If $ConnectedSocket >= 0 Then $ip2 = TCPRecv($connectedsocket,1000000) ;create new socket to send connected message $socket2 = TCPConnect($ip2, $port) TCPSend($socket2, "connected") Sleep(2000) EndIf WEnd TCPCloseSocket($connectedsocket) TCPCloseSocket($socket2) TCPShutdown() Client: Global $Connected2 $IP = "192.168.2.8" $Port =65432 $MyIP = @IPAddress1 ;Start TCP services TCPStartup() ;Connecting to main socket $ConnectedSocket = TCPConnect($IP, $Port) If @error Then MsgBox(4096, "Error ", "TCPConnect error: " & @error) EndIf ;Send info TCPSend($ConnectedSocket, $MyIP) ; Create a Listening "SOCKET" $MainSocket2 = TCPListen($MyIP, $Port) If $MainSocket2 = -1 Then Exit While 1 $Connected2 = TCPAccept( $MainSocket2) ; look for client connection $recv = TCPRecv($Connected2, 10000000) If Not @error Then Endit() WEnd Func Endit() MsgBox(0,"connected",$recv) TCPCloseSocket($ConnectedSocket) sleep(300) TCPCloseSocket($Connected2) TCPShutdown ( ) exit EndFunc Thanks for the time Link to comment Share on other sites More sharing options...
gononono64 Posted May 5, 2010 Author Share Posted May 5, 2010 anyone?.... i unno... please ? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 5, 2010 Share Posted May 5, 2010 So what is the problem then? Your description is so cloudy I can slice it with a knife.Oh and read When should I bump my threads? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gononono64 Posted May 5, 2010 Author Share Posted May 5, 2010 kk well im sorry i was not clear... what i mean is... you should be able to connect one computer to another computer via internet right? This is all i want to do... i want to be able to send information from one computer to another using a server/client method. If you could at all help me it would be much appreciated. And i figured it had been long enough for me to bump. 17 hours?... thats not bad Link to comment Share on other sites More sharing options...
evilertoaster Posted May 5, 2010 Share Posted May 5, 2010 $IP = "192.168.2.8" Will never work over the internet because it's a local address. The problem isn't related to AutoIt, but rather a lack of TCP/IP networking knowledge... you'll most likely want to read up on "port forwarding", in order to make you script work though a router.http://en.wikipedia.org/wiki/Port_forwarding Link to comment Share on other sites More sharing options...
gononono64 Posted May 6, 2010 Author Share Posted May 6, 2010 Thank you Evilertoaster. You are right. I am pretty new to all this and am just doing it as a hobby. I am of course still learning and only able to do so through the web. I Barely know anything about networking or the code in autoit for networking and this is why im here ... Thanks for the info about about port forwarding but unfortunately i still do not understand how to make my code do what i want it to do. If you can find something similar to what i want i would like to see it , not to steal, but to learn. It would be much appreciated Thanks again Link to comment Share on other sites More sharing options...
jchd Posted May 6, 2010 Share Posted May 6, 2010 You should first google for good network tutorials before starting. Not only you'll learn a lot, but it will save you from months of pointless frustration and dead ends. People here are generally very helpful w.r.t. AutoIt and a particular situation, but nobody can possibly teach you networking basics in AutoIt forums. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
gononono64 Posted May 6, 2010 Author Share Posted May 6, 2010 what exactly will i learn in networking thatll help? Link to comment Share on other sites More sharing options...
jchd Posted May 6, 2010 Share Posted May 6, 2010 Everything you need! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
gononono64 Posted May 6, 2010 Author Share Posted May 6, 2010 lol okay... ill search for a good tutorial and post back after im done Link to comment Share on other sites More sharing options...
darkjohn20 Posted May 6, 2010 Share Posted May 6, 2010 (edited) Also, check out _GetIP(). Edited May 6, 2010 by darkjohn20 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now