Is any solution to make interactive TCP/UDP server under Linux?SpamAssassin Under Linux VPSLinux bridge...
Is it possible for a particle to decay via gravity?
Patio gate not at right angle to the house
Why tantalum for the Hayabusa bullets?
How to efficiently shred a lot of cabbage?
PCB design using code instead of clicking a mouse?
What force enables us to walk? Friction or normal reaction?
What is the highest achievable score in Catan
What Marvel character has this 'W' symbol?
Best Ergonomic Design for a handheld ranged weapon
Are all French verb conjugation tenses and moods practical and efficient?
What is the difference between "baruch" and "mevorach" regarding G-d?
Did Vladimir Lenin have a cat?
Avoiding Implicit Conversion in Constructor. Explicit keyword doesn't help here
Why would an invisible personal shield be necessary?
What is a good example for artistic ND filter applications?
How to foreshadow to avoid a 'deus ex machina'-construction
How does Asimov's second law deal with contradictory orders from different people?
How would a lunar colony attack Earth?
Easy way to get process from window
Security measures that could plausibly last 150+ years?
Was Donald Trump at ground zero helping out on 9-11?
How to prevent a single-element caster from being useless against immune foes?
How did astronauts using rovers tell direction without compasses on the Moon?
How to choose using Collection<Id> rather than Collection<String>, or the opposite?
Is any solution to make interactive TCP/UDP server under Linux?
SpamAssassin Under Linux VPSLinux bridge blocks UDP packet from tap interfaceslisten to a conversation using port forwardingRelay server for generic TCP traffic?how to get statistics of received packets on a specific udp portWriting a TCP server in bashCreate UDP to TCP bridge with socat/netcat to relay control commands for vlc media-playerDisable TCP packet processing by Linux Kernel on a specific portIs there any way to encapsulate RTP/RTSP/RTCP into one TCP connection?Deployment of haproxy between devices and Syslog server
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I need some tool like this one for Linux. I need not a GUI (i.e. GUI/CLI -- this is not so important), but I need to be able to make a server which can listen at any port, receive and send a raw (i.e. a hex dump) data.
linux tcp udp
add a comment |
I need some tool like this one for Linux. I need not a GUI (i.e. GUI/CLI -- this is not so important), but I need to be able to make a server which can listen at any port, receive and send a raw (i.e. a hex dump) data.
linux tcp udp
Your reference link is no longer valid so unfortunately your question no longer has any usable content.
– roaima
12 mins ago
add a comment |
I need some tool like this one for Linux. I need not a GUI (i.e. GUI/CLI -- this is not so important), but I need to be able to make a server which can listen at any port, receive and send a raw (i.e. a hex dump) data.
linux tcp udp
I need some tool like this one for Linux. I need not a GUI (i.e. GUI/CLI -- this is not so important), but I need to be able to make a server which can listen at any port, receive and send a raw (i.e. a hex dump) data.
linux tcp udp
linux tcp udp
edited Oct 16 '15 at 18:34
Serge Roussak
asked Oct 15 '15 at 8:57
Serge RoussakSerge Roussak
1918 bronze badges
1918 bronze badges
Your reference link is no longer valid so unfortunately your question no longer has any usable content.
– roaima
12 mins ago
add a comment |
Your reference link is no longer valid so unfortunately your question no longer has any usable content.
– roaima
12 mins ago
Your reference link is no longer valid so unfortunately your question no longer has any usable content.
– roaima
12 mins ago
Your reference link is no longer valid so unfortunately your question no longer has any usable content.
– roaima
12 mins ago
add a comment |
4 Answers
4
active
oldest
votes
try nc
from man nc
nc — arbitrary TCP and UDP connections and listens
I know about it. But how can I to receive and send a raw (hex) data interactively? I.e. I need to start a server, then send some data to it (using nc or other soft), see what was received and send a (raw) answer back. May you give me an example please?
– Serge Roussak
Oct 15 '15 at 12:48
add a comment |
socat is a sophisticated tool to connect, bidirectionally, almost anything to almost anything else. In particular, you can get it to listen on a port
for connections, run a program when connected, send the data to it, and
return output back to the socket. Eg:
socat TCP4-LISTEN:3344,reuseaddr,fork EXEC:/tmp/runme,pty
will run a script /tmp/runme
eg:
#!/bin/bash
trap 'echo sigterm >&2;exit' TERM
echo "start" >&2
while read line
do echo "got $line"
done
in which you can do what you like with the data, such as here
returning it with the prefix "got ". You can test this with, eg, telnet localhost 3344
or
echo hi | socat - TCP4:localhost:3344
If you need to do the same with udp you can instead try, eg:
socat UDP-RECVFROM:3344,fork EXEC:/tmp/runme,pty
you will only be passed one packet, but you still get any reply.
Test it with, eg:
echo hi | socat - UDP-SENDTO:localhost:3344
If all you want to do is get your data echoed back, this feature is built into xinetd
, and you only need enable the echo service. See man xinetd.conf
.
If you want to get bandwidth statistics, look at the netperf tool.
Thank you. It seems I wrote my question unclearly. I bypassed that I want to get a hex dump and to type a hex and send corresponding binary data back. So, I investigated the socat a little in a last days and it seems it is a good stuff for my issue, but it have not a hex i/o. So it needs an external tool/script to do this conversion. Maybe could you suggest it?
– Serge Roussak
Oct 16 '15 at 18:33
You can pipe the raw data intoxxd -p
to get long lines of hex, and for the reverse pipe intoxxd -r -p
to convert hex lines into data.
– meuh
Oct 16 '15 at 18:39
I know about it too, but it waits the eof so it is inconvenient for my task. I think there's need to write a little script or a program in C.
– Serge Roussak
Oct 16 '15 at 18:46
add a comment |
You might be interested in sendip
, its website: http://snad.ncsl.nist.gov/ipv6/sendip.html
From the site:
Q: How are string and numeric arguments handled? A: Many of the header fields, and the packet data area, can be specified via the following syntax:
- 0xXXXX - interpreted as a number in hex, converted to a binary number in network byte order.
- 0XXXX - interpreted as a number in octal, converted to a binary number in network byte order.
- rN - N "random" bytes
- zN - N nul (zero) bytes
- fF - read the argument from the next line in file F
- other - taken as a literal string
May be, but as far as I understood sendip can not be a server.
– Serge Roussak
Oct 16 '15 at 6:34
add a comment |
There is a patch for socat v.2.0.0.b8 which makes it possible.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f236336%2fis-any-solution-to-make-interactive-tcp-udp-server-under-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
try nc
from man nc
nc — arbitrary TCP and UDP connections and listens
I know about it. But how can I to receive and send a raw (hex) data interactively? I.e. I need to start a server, then send some data to it (using nc or other soft), see what was received and send a (raw) answer back. May you give me an example please?
– Serge Roussak
Oct 15 '15 at 12:48
add a comment |
try nc
from man nc
nc — arbitrary TCP and UDP connections and listens
I know about it. But how can I to receive and send a raw (hex) data interactively? I.e. I need to start a server, then send some data to it (using nc or other soft), see what was received and send a (raw) answer back. May you give me an example please?
– Serge Roussak
Oct 15 '15 at 12:48
add a comment |
try nc
from man nc
nc — arbitrary TCP and UDP connections and listens
try nc
from man nc
nc — arbitrary TCP and UDP connections and listens
answered Oct 15 '15 at 9:02
ArchemarArchemar
21.3k9 gold badges40 silver badges76 bronze badges
21.3k9 gold badges40 silver badges76 bronze badges
I know about it. But how can I to receive and send a raw (hex) data interactively? I.e. I need to start a server, then send some data to it (using nc or other soft), see what was received and send a (raw) answer back. May you give me an example please?
– Serge Roussak
Oct 15 '15 at 12:48
add a comment |
I know about it. But how can I to receive and send a raw (hex) data interactively? I.e. I need to start a server, then send some data to it (using nc or other soft), see what was received and send a (raw) answer back. May you give me an example please?
– Serge Roussak
Oct 15 '15 at 12:48
I know about it. But how can I to receive and send a raw (hex) data interactively? I.e. I need to start a server, then send some data to it (using nc or other soft), see what was received and send a (raw) answer back. May you give me an example please?
– Serge Roussak
Oct 15 '15 at 12:48
I know about it. But how can I to receive and send a raw (hex) data interactively? I.e. I need to start a server, then send some data to it (using nc or other soft), see what was received and send a (raw) answer back. May you give me an example please?
– Serge Roussak
Oct 15 '15 at 12:48
add a comment |
socat is a sophisticated tool to connect, bidirectionally, almost anything to almost anything else. In particular, you can get it to listen on a port
for connections, run a program when connected, send the data to it, and
return output back to the socket. Eg:
socat TCP4-LISTEN:3344,reuseaddr,fork EXEC:/tmp/runme,pty
will run a script /tmp/runme
eg:
#!/bin/bash
trap 'echo sigterm >&2;exit' TERM
echo "start" >&2
while read line
do echo "got $line"
done
in which you can do what you like with the data, such as here
returning it with the prefix "got ". You can test this with, eg, telnet localhost 3344
or
echo hi | socat - TCP4:localhost:3344
If you need to do the same with udp you can instead try, eg:
socat UDP-RECVFROM:3344,fork EXEC:/tmp/runme,pty
you will only be passed one packet, but you still get any reply.
Test it with, eg:
echo hi | socat - UDP-SENDTO:localhost:3344
If all you want to do is get your data echoed back, this feature is built into xinetd
, and you only need enable the echo service. See man xinetd.conf
.
If you want to get bandwidth statistics, look at the netperf tool.
Thank you. It seems I wrote my question unclearly. I bypassed that I want to get a hex dump and to type a hex and send corresponding binary data back. So, I investigated the socat a little in a last days and it seems it is a good stuff for my issue, but it have not a hex i/o. So it needs an external tool/script to do this conversion. Maybe could you suggest it?
– Serge Roussak
Oct 16 '15 at 18:33
You can pipe the raw data intoxxd -p
to get long lines of hex, and for the reverse pipe intoxxd -r -p
to convert hex lines into data.
– meuh
Oct 16 '15 at 18:39
I know about it too, but it waits the eof so it is inconvenient for my task. I think there's need to write a little script or a program in C.
– Serge Roussak
Oct 16 '15 at 18:46
add a comment |
socat is a sophisticated tool to connect, bidirectionally, almost anything to almost anything else. In particular, you can get it to listen on a port
for connections, run a program when connected, send the data to it, and
return output back to the socket. Eg:
socat TCP4-LISTEN:3344,reuseaddr,fork EXEC:/tmp/runme,pty
will run a script /tmp/runme
eg:
#!/bin/bash
trap 'echo sigterm >&2;exit' TERM
echo "start" >&2
while read line
do echo "got $line"
done
in which you can do what you like with the data, such as here
returning it with the prefix "got ". You can test this with, eg, telnet localhost 3344
or
echo hi | socat - TCP4:localhost:3344
If you need to do the same with udp you can instead try, eg:
socat UDP-RECVFROM:3344,fork EXEC:/tmp/runme,pty
you will only be passed one packet, but you still get any reply.
Test it with, eg:
echo hi | socat - UDP-SENDTO:localhost:3344
If all you want to do is get your data echoed back, this feature is built into xinetd
, and you only need enable the echo service. See man xinetd.conf
.
If you want to get bandwidth statistics, look at the netperf tool.
Thank you. It seems I wrote my question unclearly. I bypassed that I want to get a hex dump and to type a hex and send corresponding binary data back. So, I investigated the socat a little in a last days and it seems it is a good stuff for my issue, but it have not a hex i/o. So it needs an external tool/script to do this conversion. Maybe could you suggest it?
– Serge Roussak
Oct 16 '15 at 18:33
You can pipe the raw data intoxxd -p
to get long lines of hex, and for the reverse pipe intoxxd -r -p
to convert hex lines into data.
– meuh
Oct 16 '15 at 18:39
I know about it too, but it waits the eof so it is inconvenient for my task. I think there's need to write a little script or a program in C.
– Serge Roussak
Oct 16 '15 at 18:46
add a comment |
socat is a sophisticated tool to connect, bidirectionally, almost anything to almost anything else. In particular, you can get it to listen on a port
for connections, run a program when connected, send the data to it, and
return output back to the socket. Eg:
socat TCP4-LISTEN:3344,reuseaddr,fork EXEC:/tmp/runme,pty
will run a script /tmp/runme
eg:
#!/bin/bash
trap 'echo sigterm >&2;exit' TERM
echo "start" >&2
while read line
do echo "got $line"
done
in which you can do what you like with the data, such as here
returning it with the prefix "got ". You can test this with, eg, telnet localhost 3344
or
echo hi | socat - TCP4:localhost:3344
If you need to do the same with udp you can instead try, eg:
socat UDP-RECVFROM:3344,fork EXEC:/tmp/runme,pty
you will only be passed one packet, but you still get any reply.
Test it with, eg:
echo hi | socat - UDP-SENDTO:localhost:3344
If all you want to do is get your data echoed back, this feature is built into xinetd
, and you only need enable the echo service. See man xinetd.conf
.
If you want to get bandwidth statistics, look at the netperf tool.
socat is a sophisticated tool to connect, bidirectionally, almost anything to almost anything else. In particular, you can get it to listen on a port
for connections, run a program when connected, send the data to it, and
return output back to the socket. Eg:
socat TCP4-LISTEN:3344,reuseaddr,fork EXEC:/tmp/runme,pty
will run a script /tmp/runme
eg:
#!/bin/bash
trap 'echo sigterm >&2;exit' TERM
echo "start" >&2
while read line
do echo "got $line"
done
in which you can do what you like with the data, such as here
returning it with the prefix "got ". You can test this with, eg, telnet localhost 3344
or
echo hi | socat - TCP4:localhost:3344
If you need to do the same with udp you can instead try, eg:
socat UDP-RECVFROM:3344,fork EXEC:/tmp/runme,pty
you will only be passed one packet, but you still get any reply.
Test it with, eg:
echo hi | socat - UDP-SENDTO:localhost:3344
If all you want to do is get your data echoed back, this feature is built into xinetd
, and you only need enable the echo service. See man xinetd.conf
.
If you want to get bandwidth statistics, look at the netperf tool.
answered Oct 16 '15 at 17:44
meuhmeuh
33.7k1 gold badge25 silver badges59 bronze badges
33.7k1 gold badge25 silver badges59 bronze badges
Thank you. It seems I wrote my question unclearly. I bypassed that I want to get a hex dump and to type a hex and send corresponding binary data back. So, I investigated the socat a little in a last days and it seems it is a good stuff for my issue, but it have not a hex i/o. So it needs an external tool/script to do this conversion. Maybe could you suggest it?
– Serge Roussak
Oct 16 '15 at 18:33
You can pipe the raw data intoxxd -p
to get long lines of hex, and for the reverse pipe intoxxd -r -p
to convert hex lines into data.
– meuh
Oct 16 '15 at 18:39
I know about it too, but it waits the eof so it is inconvenient for my task. I think there's need to write a little script or a program in C.
– Serge Roussak
Oct 16 '15 at 18:46
add a comment |
Thank you. It seems I wrote my question unclearly. I bypassed that I want to get a hex dump and to type a hex and send corresponding binary data back. So, I investigated the socat a little in a last days and it seems it is a good stuff for my issue, but it have not a hex i/o. So it needs an external tool/script to do this conversion. Maybe could you suggest it?
– Serge Roussak
Oct 16 '15 at 18:33
You can pipe the raw data intoxxd -p
to get long lines of hex, and for the reverse pipe intoxxd -r -p
to convert hex lines into data.
– meuh
Oct 16 '15 at 18:39
I know about it too, but it waits the eof so it is inconvenient for my task. I think there's need to write a little script or a program in C.
– Serge Roussak
Oct 16 '15 at 18:46
Thank you. It seems I wrote my question unclearly. I bypassed that I want to get a hex dump and to type a hex and send corresponding binary data back. So, I investigated the socat a little in a last days and it seems it is a good stuff for my issue, but it have not a hex i/o. So it needs an external tool/script to do this conversion. Maybe could you suggest it?
– Serge Roussak
Oct 16 '15 at 18:33
Thank you. It seems I wrote my question unclearly. I bypassed that I want to get a hex dump and to type a hex and send corresponding binary data back. So, I investigated the socat a little in a last days and it seems it is a good stuff for my issue, but it have not a hex i/o. So it needs an external tool/script to do this conversion. Maybe could you suggest it?
– Serge Roussak
Oct 16 '15 at 18:33
You can pipe the raw data into
xxd -p
to get long lines of hex, and for the reverse pipe into xxd -r -p
to convert hex lines into data.– meuh
Oct 16 '15 at 18:39
You can pipe the raw data into
xxd -p
to get long lines of hex, and for the reverse pipe into xxd -r -p
to convert hex lines into data.– meuh
Oct 16 '15 at 18:39
I know about it too, but it waits the eof so it is inconvenient for my task. I think there's need to write a little script or a program in C.
– Serge Roussak
Oct 16 '15 at 18:46
I know about it too, but it waits the eof so it is inconvenient for my task. I think there's need to write a little script or a program in C.
– Serge Roussak
Oct 16 '15 at 18:46
add a comment |
You might be interested in sendip
, its website: http://snad.ncsl.nist.gov/ipv6/sendip.html
From the site:
Q: How are string and numeric arguments handled? A: Many of the header fields, and the packet data area, can be specified via the following syntax:
- 0xXXXX - interpreted as a number in hex, converted to a binary number in network byte order.
- 0XXXX - interpreted as a number in octal, converted to a binary number in network byte order.
- rN - N "random" bytes
- zN - N nul (zero) bytes
- fF - read the argument from the next line in file F
- other - taken as a literal string
May be, but as far as I understood sendip can not be a server.
– Serge Roussak
Oct 16 '15 at 6:34
add a comment |
You might be interested in sendip
, its website: http://snad.ncsl.nist.gov/ipv6/sendip.html
From the site:
Q: How are string and numeric arguments handled? A: Many of the header fields, and the packet data area, can be specified via the following syntax:
- 0xXXXX - interpreted as a number in hex, converted to a binary number in network byte order.
- 0XXXX - interpreted as a number in octal, converted to a binary number in network byte order.
- rN - N "random" bytes
- zN - N nul (zero) bytes
- fF - read the argument from the next line in file F
- other - taken as a literal string
May be, but as far as I understood sendip can not be a server.
– Serge Roussak
Oct 16 '15 at 6:34
add a comment |
You might be interested in sendip
, its website: http://snad.ncsl.nist.gov/ipv6/sendip.html
From the site:
Q: How are string and numeric arguments handled? A: Many of the header fields, and the packet data area, can be specified via the following syntax:
- 0xXXXX - interpreted as a number in hex, converted to a binary number in network byte order.
- 0XXXX - interpreted as a number in octal, converted to a binary number in network byte order.
- rN - N "random" bytes
- zN - N nul (zero) bytes
- fF - read the argument from the next line in file F
- other - taken as a literal string
You might be interested in sendip
, its website: http://snad.ncsl.nist.gov/ipv6/sendip.html
From the site:
Q: How are string and numeric arguments handled? A: Many of the header fields, and the packet data area, can be specified via the following syntax:
- 0xXXXX - interpreted as a number in hex, converted to a binary number in network byte order.
- 0XXXX - interpreted as a number in octal, converted to a binary number in network byte order.
- rN - N "random" bytes
- zN - N nul (zero) bytes
- fF - read the argument from the next line in file F
- other - taken as a literal string
answered Oct 15 '15 at 19:08
phkphk
4,1295 gold badges24 silver badges57 bronze badges
4,1295 gold badges24 silver badges57 bronze badges
May be, but as far as I understood sendip can not be a server.
– Serge Roussak
Oct 16 '15 at 6:34
add a comment |
May be, but as far as I understood sendip can not be a server.
– Serge Roussak
Oct 16 '15 at 6:34
May be, but as far as I understood sendip can not be a server.
– Serge Roussak
Oct 16 '15 at 6:34
May be, but as far as I understood sendip can not be a server.
– Serge Roussak
Oct 16 '15 at 6:34
add a comment |
There is a patch for socat v.2.0.0.b8 which makes it possible.
add a comment |
There is a patch for socat v.2.0.0.b8 which makes it possible.
add a comment |
There is a patch for socat v.2.0.0.b8 which makes it possible.
There is a patch for socat v.2.0.0.b8 which makes it possible.
edited 1 hour ago
Pang
1731 silver badge7 bronze badges
1731 silver badge7 bronze badges
answered Oct 23 '15 at 9:17
Serge RoussakSerge Roussak
1918 bronze badges
1918 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f236336%2fis-any-solution-to-make-interactive-tcp-udp-server-under-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Your reference link is no longer valid so unfortunately your question no longer has any usable content.
– roaima
12 mins ago