LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2017, 10:53 AM   #1
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Rep: Reputation: 40
Question Fedora 25 : no /etc/tcp/*


Hello,

I came a few old(ish) and new (2016 http://xmodulo.com/tcp-udp-socket-bash-shell.html) posts indicating that newer (ba)sh versions should be able to communicate over /dev/tcp/* , dev/udp/* device files.

On F25:
Code:
[az@netdev NJA]$ which bash
/usr/bin/bash

bash --version
GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[az@netdev NJA]$ strings /usr/bin/bash | grep tcp
/dev/tcp/*/*
and yet i see no /dev/tcp|udp devices. Is there something else i need to enable?
 
Old 10-11-2017, 05:11 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
No, /dev/tcp|udp is a pseudo-path and does not actually exist. All you need to do is run the exec command as shown in the examples.

Have you tried to fetch a remote web page and print its contents as shown in the link?
Code:
#!/bin/bash
exec 3<>/dev/tcp/xmodulo.com/80
echo -e "GET / HTTP/1.1\r\nhost: xmodulo.com\r\nConnection: close\r\n\r\n" >&3
cat <&3
 
1 members found this post helpful.
Old 10-11-2017, 09:20 PM   #3
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by michaelk View Post
No, /dev/tcp|udp is a pseudo-path and does not actually exist. All you need to do is run the exec command as shown in the examples.

Have you tried to fetch a remote web page and print its contents as shown in the link?
Code:
#!/bin/bash
exec 3<>/dev/tcp/xmodulo.com/80
echo -e "GET / HTTP/1.1\r\nhost: xmodulo.com\r\nConnection: close\r\n\r\n" >&3
cat <&3
not exactly. I tried to "cat" on the device - as a quick way to check if there is any service on the port. In my case there should be some Java application there.
Your example works perfectly fine. Thank you. Now, i'm not sure how to test that java thingy..
 
Old 10-12-2017, 05:40 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
It depends on how the Java program works. Can you post the application name? Is it something you wrote?
 
Old 10-12-2017, 08:37 AM   #5
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by michaelk View Post
It depends on how the Java program works. Can you post the application name? Is it something you wrote?
oh, yes, this is Apache Jmeter (http://jmeter.apache.org/)
 
Old 10-12-2017, 09:08 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
JMeter load tests and measures performance of web applications. So it will communicate with a server and not necessarily respond to input.

I suggest setting up a test environment for whatever you want to use JMeter for and follow the manual.
 
Old 10-12-2017, 10:02 AM   #7
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 568

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by michaelk View Post
JMeter load tests and measures performance of web applications. So it will communicate with a server and not necessarily respond to input.

I suggest setting up a test environment for whatever you want to use JMeter for and follow the manual.
xa good point. to be honest, this is exactly what i'm doing - test env and trying out few things
 
  


Reply

Tags
/dev/tcp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vuze (Azureus) 4.6 NAT problem with the TCP port in Fedora 15 Neyzan Linux - Software 0 10-31-2011 09:09 AM
slow tcp on 100mbps wan, strange tcp window behaviour on ubuntu 9.10 cputoaster Linux - Networking 2 03-10-2010 12:43 AM
how to swtich off the -nolisten TCP option of X in fedora 9 nkd Fedora 1 12-28-2008 09:32 AM
Linux change TCP kernel Parameter for TCP DELAY ACK TICKS linux_mando Linux - Networking 5 08-22-2006 08:20 AM
Fedora 3 setting up TCP/iP Coenv123 Linux - General 1 05-31-2005 10:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration