Jump to content


Sending a text string over TCP


  • Please log in to reply
7 replies to this topic

#1 Guests

  • Guests

Posted 27 December 2011 - 02:56 PM

Hello

I have 2 pieces of software that communicate over TCP. One issues 'instructions' on how the other should look and what it displays (imagine A is a control panel and B is like a display screen). Using a socket sniffer I have intercepted a series of very simple single line commands from A to B (such as "turn_on" and "turn_off" etc). Software B simply receives and doesn't respond to the command over the network.

My question is, can I use AHK to make key presses send these text string commands to an IP address and port, hopefully elimitating the transmitting software from the equation and use an AHK script instead?

I have tried to use several example scripts in the AHKsock section and even tried to reverse engineer some of the remote control scripts without any success. Help or advice would be appreciated...

Thanks

#2 kris

kris
  • Members
  • 10 posts

Posted 27 December 2011 - 02:57 PM

PS - that was my post... username spelt wrong on the post :oops:

Kris

#3 kris

kris
  • Members
  • 10 posts

Posted 20 April 2012 - 10:02 AM

Not sure on the etiquette of bumping my own topic, but still stuck on this... :oops: :(

Thanks in advance

#4 CodeKiller

CodeKiller
  • Members
  • 2066 posts

Posted 20 April 2012 - 12:07 PM

If you know how to do it in C++ you can try this way :
<!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?t=59593">viewtopic.php?t=59593</a><!-- l -->
I know it's a lot of reading but with that way you can get it.

#5 kris

kris
  • Members
  • 10 posts

Posted 20 April 2012 - 12:33 PM

Thanks very much - I think the original software I'm trying to access is programmed that way but I thought there may have been a shortcut!

Let the reading begin...

#6 gamax92

gamax92
  • Members
  • 410 posts

Posted 20 April 2012 - 02:40 PM

It is possible to do so in AHK. Though I myself do not understand the concept and haven't gotten it to work correctly.

You can try using the Winsock wrapper for AHK

#7 lblb

lblb
  • Guests

Posted 20 April 2012 - 03:40 PM

Maybe the following could be helpful?

http://www.autohotke...php?f=2&t=28838

I modified it to remotely control the volume and play/pause media players. The way it works is that the commands are included in a AHK file on the remotely-controlled computer, and the "controlling" computer just tells it to launch these commands when you press buttons on the GUI. For example, for some of the commands, I use ControlSend and, as you can see from the Ultra Basic Chat button that the developer included, the info can be sent back and forth between two different computers.

#8 maul.esel

maul.esel
  • Members
  • 790 posts

Posted 20 April 2012 - 07:59 PM

In the German forum, there's a class-based library available: <!-- m -->http://de.autohotkey...opic.php?t=8587<!-- m -->
You might try it, I guess the methods should be intuitive if someone is familiar with TCP (?).