Aro2220 Posted May 8, 2010 Share Posted May 8, 2010 (edited) I'm trying to send/receive TCP messages between two of my computers:#include "TCP.au3" Global $sMessage = "----" Global $random = 0 Func Communicate($comm) $sMessage = $comm $hClient = _TCP_Client_Create("192.168.0.100", 88) _TCP_RegisterEvent($hClient, $TCP_SEND, "SendIt") EndFunc Func SendIt($hSocket, $iError) _TCP_Send($hSocket, $sMessage) EndFunc Func Received($hSocket, $sReceived, $iError) ToolTip("SERVER: We recieved this: "& $sReceived, 10, 10) $sGetMsg = $sReceived EndFuncThis successfully sends messages.;$hServer = _TCP_Server_Create($myport) ;_TCP_RegisterEvent($hServer, $TCP_RECEIVE, "Received") Communicate("blah")This successfully receives messages.$hServer = _TCP_Server_Create($myport) _TCP_RegisterEvent($hServer, $TCP_RECEIVE, "Received") ;Communicate("blah")This neither sends nor receives messages.$hServer = _TCP_Server_Create($myport) _TCP_RegisterEvent($hServer, $TCP_RECEIVE, "Received") Communicate("blah")Why?TCP.au3 Edited May 8, 2010 by Aro2220 Link to comment Share on other sites More sharing options...
Kip Posted May 8, 2010 Share Posted May 8, 2010 Why?God damnit, READ!First post of my UDF:You can't create a server and a client in the same script.And even on the last page of that topic:When are people going to learn to read?My first post clearly states, in a very nice underlined font, that: MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Aro2220 Posted May 8, 2010 Author Share Posted May 8, 2010 (edited) God damnit, READ!First post of my UDF:And even on the last page of that topic:Is there a workaround?Sometimes messages do not go through and it goofs up my script. I wanted to have error checking so I could wait until the message was received.I see that I can not but do not understand why I can not. What you are telling me is that, "you can't because you can't." Edited May 8, 2010 by Aro2220 Link to comment Share on other sites More sharing options...
Kip Posted May 8, 2010 Share Posted May 8, 2010 Is there a workaround?Sometimes messages do not go through and it goofs up my script. I wanted to have error checking so I could wait until the message was received.I see that I can not but do not understand why I can not. What you are telling me is that, "you can't because you can't."AutoIt limitations MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
darkjohn20 Posted May 9, 2010 Share Posted May 9, 2010 If you really care that much, make 2 scripts. One will be the client, one will be the server, and have them communicate to each other through something such as a hidden window. Link to comment Share on other sites More sharing options...
storme Posted May 9, 2010 Share Posted May 9, 2010 (edited) Is there a workaround?Sometimes messages do not go through and it goofs up my script. I wanted to have error checking so I could wait until the message was received.I see that I can not but do not understand why I can not. What you are telling me is that, "you can't because you can't."If you can designate one of the computers as server then you just set up a normal client-server connection and pass messages back and forth that way. The example scripts on Kips thread pass messages back and forth.If you can't designate a server then 2 programs (1 client, 1 server) is the only alternative I can suggest at the moment.Good Luck! Edited May 9, 2010 by storme Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E 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