Jump to content
Sign in to follow this  

Little problem with IP-Socket communication

Recommended Posts

Im new in Autoit an also new in TCP communication.

I want do build a tool to get information about a GIFTCARD.

The communication should go over IP-Socket.

This is what i have:

2.3 Message Format

Transfer of Request and Response parameters happens using direct port


- parameters handled as key/value pairs

- key names are NOT case sensitive

- required format: key=value

- the key/value pairs may be submitted in unspecified order

- each key/value pair is ended by a newline ASCII character sequence

o for request parameters following delimiter characters are accepted: CR+LF (integer values 13 and 10, typically used by Microsoft

Windows) LF (integer value 10, typically used by Unix and Unix-like


o for response parameters following ASCII character sequence for

[Newline] is used CR+LF (integer values 13 and 10, typically used by Microsoft


- after all parameters a EOF must be sent. (Unix EOF Character, integer value

4) This character must also be followed by a newline ASCII character

sequence (CR+LF or LF).


- All fields in the message must be submitted in ASCII format

- Unused fields are not required to be sent.

- See Chapter Input Validation for detailed required parameter format


CARD_ID=10 digits

TRANS_TYP=20 (Retrive card's balance information and configuration parameters independent of card state.

An this is what i have coded in Autoit but the server give me always Error 100

Error 100 = Unexpected system exceptions

So TCP Connection is ok but the server don't understand what i want.

Global $IP = ""
Global $PORT = 4999
Global $Connect = -1, $Recv
; to test
$asc10 = chr("10")
$asc4 = chr("4")


$txt = "CARD_ID=4747335296"& $asc10 &"TRANS_TYPE=20" & $asc10 & $asc4

;for testing $txt
MsgBox(0,"Send TXT",$txt)

While $Connect = -1
    $Connect = TCPConnect($IP, $PORT)

TCPSend($PORT,"CARD_ID=4747335296"& $asc10 &"TRANS_TYPE=20" & $asc10 & $asc4)

While $Recv = ''
    $Recv = TCPRecv($Connect, 100)


I hope someone can help me.


Christian Fiesel

Share this post

Link to post
Share on other sites

While $Connect = -1

$Connect = TCPConnect($IP, $PORT)



TCPSend($PORT,"CARD_ID=4747335296"& $asc10 &"TRANS_TYPE=20" & $asc10 & $asc4)

The TCPSend requires an opened socket. You are sending to the port, but no the opened $Connect socket. <_<

From the help-file:

;Attempt to connect to SERVER at its IP and PORT 33891


$ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT)


; We should have data in $szData... lets attempt to send it through our connected socket.



Oh, and you say it's the server, but ur code says it's the client? :)

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...