GoFor Posted January 9, 2015 Share Posted January 9, 2015 Hi guys, i Have problem with connecting to server. This is the part of code: Client: #include <GUIConstants.au3> TCPStartup() ;start usługi TCP Global $serwer1 = '749.0.0.3' Global $serwer2 = Null Global $serwer3 = Null Global $port = '32399' . . . $serwer=GUICtrlRead($serwery) if $serwer = 'serwer 1' Then $socket = TCPConnect($serwer1, $port) ElseIf $serwer = 'serwer 2' Then $socket = TCPConnect($serwer2, $port) ElseIf $serwer = 'serwer 3' Then $socket = TCPConnect($serwer3, $port) EndIf If $socket = -1 Then ;jeśli $socket = -1, komunikat o błędach MsgBox(16, "Błąd:", "Połączenie z serwerem nie można ustalić!") ;;just error EndIf $sendedBytes = TCPSend($socket, $wiadomosc) If $sendedBytes = 0 Then MsgBox(16, "Error", "Pakiet nie może być wysłany.") ;;just error EndIf TCPCloseSocket($socket) TCPShutdown() Server: TCPStartup() $mainsocket = TCPListen("749.0.0.3", 32399) While 1 $acceptedSocket = TCPAccept($mainsocket) If $acceptedSocket <> -1 Then $receivedData = TCPRecv($acceptedSocket, 1024) MsgBox(64, "Wiadomość otrzymana!", "Otrzymałem wiadomość: " & $receivedData) TCPCloseSocket($acceptedSocket) EndIf WEnd Sorry for Polish variables and strings. Why it doesnt work guys? Link to comment Share on other sites More sharing options...
mrider Posted January 9, 2015 Share Posted January 9, 2015 (edited) $mainsocket = TCPListen("749.0.0.3", 32399) Unless there's something obvious that I'm missing, "749.0.0.3" is not a valid address. [EDIT] On a side note - your English is pretty good, no need to apologize. However, you might be interested do know that you probably want "$server", not "$sewer" since a "sewer" is what a toilet connects to. [EDIT2] s/you're/your/ . (Better than my English apparently... ) Edited January 9, 2015 by mrider How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
GoFor Posted January 9, 2015 Author Share Posted January 9, 2015 Oh You're right with ""749.0.0.3" is not a valid address.". But there isn't "sewer" but "serwer". "serwer" means in english "server". Thanks for help bro Link to comment Share on other sites More sharing options...
mrider Posted January 9, 2015 Share Posted January 9, 2015 LOL. I looked at "$serwer" and saw "$sewer". I guess it shows where my thoughts are! Anyway, I hope that helped. GoFor 1 How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
GoFor Posted January 10, 2015 Author Share Posted January 10, 2015 But what ip i should use guys? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 10, 2015 Developers Share Posted January 10, 2015 (edited) But what ip i should use guys? Shouldn't you know that answer? Use one of the active IP addresses of your server. Jos Edited January 10, 2015 by 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 More sharing options...
GoFor Posted January 15, 2015 Author Share Posted January 15, 2015 I must use ip of my computer? Link to comment Share on other sites More sharing options...
JohnOne Posted January 15, 2015 Share Posted January 15, 2015 If both server and client are on your computer then yes, unless you can use localhost, not used to the TCP stuff. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
GoFor Posted January 15, 2015 Author Share Posted January 15, 2015 But i want to use TCP. And if i want to connect from my one pc to the other pc, what ip i must use? Link to comment Share on other sites More sharing options...
JohnOne Posted January 15, 2015 Share Posted January 15, 2015 The IP of whatever computer you are connecting to. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
GoFor Posted January 15, 2015 Author Share Posted January 15, 2015 I have a variable ip (translate google ;/) (changing ip?) and it will work too? Because I tried it in my 1 pc and it doesnt work ;/ Link to comment Share on other sites More sharing options...
JohnOne Posted January 15, 2015 Share Posted January 15, 2015 @IPAddress1 For you own IP. For the other, you should know it if you are connected to a network with it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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