MirnesC2 Posted December 14, 2009 Share Posted December 14, 2009 Client TCPStartup() $TCPConnect = TCPConnect(@IPAddress1, 403) If $TCPConnect = -1 Then Exit TCPSend($TCPConnect, "Hello") Server TCPStartup() $TCPListen = TCPListen(@IPAddress1, 403) Do $TCPAccept = TCPAccept($TCPListen) Until $TCPAccept <> -1 Do $TCPRecive = TCPRecv($TCPAccept, 1000000) Until $TCPRecive <> "" MsgBox(0, "Data recived", $TCPRecive) Ok so I watched a tutorial online and was able to string this together. What it does is send "hello" into a message box. This only sends data from my pc to my pc. How can I make it so that I can send "Hello" from my pc to someone elses pc? Whos IP addresses do I use in each field? What port? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 14, 2009 Share Posted December 14, 2009 You need to change the ip in TCPConnect. The ports doesn't really matter much, take one that you don't use in normal case. Or let the users change themselves. .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...
PsaltyDS Posted December 14, 2009 Share Posted December 14, 2009 On the server-side, @IPAddress1 is the address that the server is listening for connections on, so that can remain unchanged. On the client-side, you want the address of the server to connect to, so change that to the address of the one running the server-side. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MirnesC2 Posted December 15, 2009 Author Share Posted December 15, 2009 So...PersonB is running server.PersonA is running client.PersonA needs to change the IP to PersonB 's IP in the client.au3?PersonB leaves @IPAddress1 as it is under server.au3?and this will allow PersonA to send a message to PersonB? Correct?Also which IP is being used? Is there a macro? ( like @IP2) Link to comment Share on other sites More sharing options...
smartee Posted December 15, 2009 Share Posted December 15, 2009 So...PersonB is running server.PersonA is running client.PersonA needs to change the IP to PersonB 's IP in the client.au3?PersonB leaves @IPAddress1 as it is under server.au3?and this will allow PersonA to send a message to PersonB? Correct?Also which IP is being used? Is there a macro? ( like @IP2)um well you will have to know the server's ip(@ipadress1 on server computer) so that the client cud connect to it.. yo can check out the tic tac toe in my signature that uses tcp.. such that the client and server software is the same Link to comment Share on other sites More sharing options...
MirnesC2 Posted December 16, 2009 Author Share Posted December 16, 2009 I modified it a bit so I can learn more about it but it doesn't seem to work the way I want it to. CLIENT #include <GUIConstantsEx.au3> GUICreate("TCPClient",180,40) GUISetState(@SW_SHOW) $packet = GUICtrlCreateInput("",10,10,90,20) $send = GUICtrlCreateButton("Send",110,10,60,20) TCPStartup() $TCPConnect = TCPConnect(@IPAddress1, 403) If $TCPConnect = -1 Then Exit While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $send TCPSend($TCPConnect, GUICtrlRead($packet)) EndSwitch WEnd SERVER TCPStartup() $TCPListen = TCPListen(@IPAddress1, 403) While 1 Do $TCPAccept = TCPAccept($TCPListen) Until $TCPAccept <> -1 Do $TCPRecive = TCPRecv($TCPAccept, 1000000) Until $TCPRecive <> "" MsgBox(0, "Data recived", $TCPRecive) If $TCPRecive = "exit" Then ExitLoop EndIf $TCPAccept = -1 $TCPRecive = "" WEnd I want to to be able to send message after message until TCPRecive(the message) = exit. 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