Visit Our UNIX and Linux User Community


Sending hex to a port


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sending hex to a port
# 1  
Old 02-08-2002
Sending hex to a port

I am trying to send hex strings down a port but the server treats the strings as ascii. When I telnet to a port, is there a way in which I can specify that the string being sent is in hexadecimal format.

I know thiis can be done quite easily in C, but can it be done using standard unix commands and preferably no in a script?

I would like to be able to do this for both HPUX and Linux.

Cheers,
LLL
# 2  
Old 02-09-2002
How are you doing it now?
You aren't just echoing the hex representation of the data, are you?
# 3  
Old 02-11-2002
Thats what I would like to do, Is there a way to set the type of infromation being sent?
# 4  
Old 02-12-2002
Well, I don't know of any way to do that in telnet, unless it's a mapped key combination you're sending (like control-M, control-s, etc...). You should be able to use netcat or something similar to provide a raw interface. Some shells, like bash and ksh, support the ability to send to a raw interface using the following format:
/dev/tcp/hostname/port
So you could send the string "hello" to port 55 of your local machine by doing this:
echo "hello" > /dev/tcp/localhost/55

To get hex, you can do something like run it through a hex dumper, like "xd" or "xxd"...
echo "Hello" | xxd -p | nc hostname port

Is that what you're looking for?
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #952
Difficulty: Medium
The Creeper virus was first detected on ARPANET in the early 1960s.
True or False?

9 More Discussions You Might Find Interesting

1. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies

2. Shell Programming and Scripting

How to replace with "sed" some hex values by other hex values?

Assume I have a file \usr\home\\somedir\myfile123.txt and I want to replace all occurencies of the two (concatenated) hex values x'AD' x'A0' bytwo other (concatenated) hex values x'20' x'6E' How can I achieve this with the gnu sed tool? Additional question: Is there a way to let sed show... (1 Reply)
Discussion started by: pstein
1 Replies

3. Solaris

How to enable Serial port on ILOM, when Network Port is enabled in parallel

Hi Everyone, In my environment, I have few T5220. On the iLOM Management Card, I have both Network and Serial port are cabled, I don't have any issues while I try to connect using Network Management port, but when I try to connect the serial port for the same server which is actually connected... (3 Replies)
Discussion started by: bobby320
3 Replies

4. Red Hat

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (1 Reply)
Discussion started by: prabakar4all
1 Replies

5. IP Networking

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (0 Replies)
Discussion started by: prabakar4all
0 Replies

6. Programming

What is the difference between ios::hex and std::hex?

Hi, Is there really a difference between these two, std::hex and ios::hex?? I stumbled upon reading a line, "std::ios::hex is a bitmask (8 on gcc) and works with setf(). std::hex is the operator". Is this true? Thanks (0 Replies)
Discussion started by: royalibrahim
0 Replies

7. Programming

After converting the hexstr to Hex and storing the Hex in a char*

Hi All, My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ',' This has to be done for all the hexstring char* is NULL. Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies

8. Fedora

Sending a byte to the parallel port

Greetings, A sort of newbie question... I would like to control a couple of stepper motors via the parallel port using C code. I have discovered in Linux, the ioperm() function is required before the outportb() function can be used to send a byte to the parallel port. My problem is ioperm()... (1 Reply)
Discussion started by: meyerga00
1 Replies

9. Shell Programming and Scripting

Perl Script - Sending files on a particular port

I've written some basic programs in Perl, but unwaware abut socket programming in Perl. I need to write a file called syslog, onto port 514 of another host from port 514 of my machine. Is this possible in Perl? Which modules are to be used? Regards, Rahul. (1 Reply)
Discussion started by: rahulrathod
1 Replies

Featured Tech Videos