I have a TCP server listening on a localhost's port so I need a software that can be used to establish a TCP connection to the server and then send binary data, not ASCII.

For example, I want to send a message that looks something like this (8 bytes written as hex):

FF00FE1200FF28CA

Are there any such programs freely available?

(EDIT: I forgot to mention, I am looking for a Windows application)

link|improve this question

73% accept rate
feedback

2 Answers

up vote 6 down vote accepted

netcat naturally - you can pipe the data to netcat from another programme or file. And here's a windows port

link|improve this answer
there's a netcat build for windows – ultrasawblade Apr 4 '11 at 13:54
+1 for netcat.. – ta.speot.is Apr 5 '11 at 3:20
feedback

The Python programming language interpreter in interactive mode can be used for this.

$ python
>>> import socket
>>> s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
>>> s.connect(("localhost", 22))                  # connect to address ("localhost", 22)
>>> s.send(b"\xff\x00\xfe\x12\x00\xff\x28\xca")   # send the data from your example
8                                                 # send() returns number of bytes written
>>> s.recv(10)                                    # receive 10 bytes

Some might prefer Ruby.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.