Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Client & Server Script for TCP/IP Network Communication

  • Please log in to reply
130 replies to this topic
  • Members
  • 6 posts
  • Last active: Nov 17 2010 06:57 PM
  • Joined: 13 Oct 2009

because it's really awesome !
thanks to everybody who has contributed so far and also to those in the future.


BF2 Player
  • Members
  • 67 posts
  • Last active: Mar 21 2010 01:10 AM
  • Joined: 27 Mar 2009
Ok, This partially works for me.
Im not getting the right result for the script im trying to create because when I send a packet,
it adds about 30 Null Characters ( 00 ) after the packet info I am trying to send.
This is making it so the server I am trying to connect to is not reading it right and it isnt
recognizing the command im sending because it is too long.
Could this be a problem with winstock or the TCP Send script?
Im connecting to a Rcon server for BF2.

  • Members
  • 2166 posts
  • Last active: Jun 11 2015 05:33 PM
  • Joined: 05 Sep 2009
Wow, I know I'll find this kind of 'server & client' thread at the forum. I read from the beginning until the end, there's a lot of code changes and add-on, but I don't know which one is the final working script..
Could anyone post the latest server & client's code? Posted Image

  • Guests
  • Last active:
  • Joined: --
I have problem:
computer1: run Server
computer2: run Client, enter IP aaaaaaaaand -> "connect() indicated winsock error 10061?" :(

  • Guests
  • Last active:
  • Joined: --
Hi i run a Server with a desktop pc and a laptop

i want to run 2 applications on the laptop that when i press the binded key on thd desktop the laptop will select both programs then for example run the key "f1" on both applications.

is this easy to add to this script?

  • Guests
  • Last active:
  • Joined: --

I have problem:
computer1: run Server
computer2: run Client, enter IP aaaaaaaaand -> "connect() indicated winsock error 10061?" :(

I encountered a similar problem. It means, that the connection was refused. This happens, if e.g. the server is not running or is running under a different IP-adress or listening to a different port. So perhaps you might want to check, whether the client is talking to the correct ip-adress and the correct port.

in my case, this also happened because of an airport express (a WiFi-Router), the server was running behind. I solved the problem using two alternatives: taking the airport express out of the connection OR ordering the airport express to reroute the public port XXXX (number known to the client) to the internal port YYYY (number known to the server). In my case, both numbers were the same. The internal ip-adress connecting to the rerouted ports was the internal ip-adress of the server.

  • Guests
  • Last active:
  • Joined: --

I copied the two scripts client and server, modified the network adress and it is working perfectly, this is exactly what I was looking for since weeks, FANTASTIC. Thanks so much

But I have been passing hours trying to understand the script, going from the script to AutoHotKey help to understand each line, but it is all to complicated for me simple user of AHK.
I have made some of my own script, I have even been able to send keystrokes from one computee to an other with the use of synergy (it allow you to basically share mouse and computer over a network)

Ok I will get to my point: can someone for the porpuse of understanding the script make it as simple as possible , just the needed and basic things to send a simple order over to the client computer, a keystroke or a MsgBox or anything easy. I was thingking of:
Push B on the server -> Client will show a MsgBox with B For example with no error reports and other things just the basic so we can understand were exactly the basic instruction are in the script.

This would be so helpfull,


  • Guests
  • Last active:
  • Joined: --
I want to make a server with java and the client with AHK. For testing the server sends everything he gets to all connected clients. But in AHK in only works for the first send, all other sends won't be showed in the AHK Window.
And on the Server side there are additional keys after the first send

1. Send [SERVER] f

[SERVER] (e)

The Problem is, when i copy [SERVER] e, as it was print out in console it only copies [SERVER] , so i have to copy e alone, I think this is also the receive problem, but how can i solve it?

  • Guests
  • Last active:
  • Joined: --
How can I make it Autoreconnect after Disconnect?

  • Members
  • 304 posts
  • Last active: Feb 28 2013 05:39 PM
  • Joined: 17 Feb 2008
Hi all,

People interested in this script may want to check out AHKSock:

It is a really very carefully written library for TCP/IP (socket) based communication. It requires a background in sockets (available online), but I think of it as superseding this script (just my opinion, and I confess not knowing this code very well any more).

If you're interested in chat programs, the author of AHKSock included 4 very carefully documented examples of how to use the library, and the third example is for a chat program.

Best of luck...

  • Guests
  • Last active:
  • Joined: --
To make this in to a chatroom, here's some tips (I'm actually working on it, I'm just putting this here.)

Add all these multiple user codes.
To make sure that you don't **** something up and look like some idiot,
URLDownloadtoFile http://cfaj.freeshell.org/ipaddr.cgi
and FileRead it to the IP address variable.
First prompt for port.
Add a bookmarks list as the first GUI that shows up so you can have a list of chatroom servers, and then add as a secondary GUI accessed through a button a IP address and port prompter.
Replace the tooltip with a read-only edit and under it a non-readonly edit with a button that sends it to the server.
Have the server redirect client chattings to everyone.
Add a username prompt and a default username.
Add a settings file to save the bookmarks, the default username, etc.
Add the same thing for the server file, just with admin commands.
Add a signature symbol list so some person doesn't abuse the commands.
:wink: What do you think? :D