Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-16-2012, 06:09 AM   #1
LQ Newbie
Registered: May 2012
Posts: 11

Rep: Reputation: Disabled
/dev/tcp not there in LINUX

I'am porting C/pro*c codes from UNIX to LINUX. The code is:

#define __NFDBIT (8 * sizeof(unsigned long))
#define __FD_SETSIZ 1024
typedef struct {
unsigned long fds_bits [__FDSET_LONG];
} __ernel_fd_set;

typedef __ernel_fd_set fd_set_1;
int main()
fd_set_1 listen_set;
int listen_sd;
int socket_id;
socket_id = t_open("/dev/tcp", O_RDWR|O_NONBLOCK, (struct t_info *) 0);
if ( socket_id <0 )
return 0;

In UNIX the value of socket_id is > 0 in Linux it is -1. Reason is in UNIX under directory /dev the file tcp is present. But in LINUX it is under /dev this tcp file is not present. Also in UNIX this tcp file is character special file which is different from normal file.

Is there any way to create same character special file in LINUX as in UNIX or how to proceed this further?

Last edited by smilebhuff; 05-16-2012 at 06:10 AM. Reason: modified code for indentation
Old 05-17-2012, 03:57 AM   #2
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,193

Rep: Reputation: 960Reputation: 960Reputation: 960Reputation: 960Reputation: 960Reputation: 960Reputation: 960Reputation: 960
What this program is supposed to do?
Old 05-17-2012, 04:40 AM   #3
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,438

Rep: Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770Reputation: 2770
please use [code][/code] to keep formatting of your code

here is a linux socket tutorial:, but I think you can find a lot of information yourself.



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
pseudo terminals: /dev/ptmx <-> /dev/pts/ vs. /dev/ptyp <-> /dev/ttyp rtspitz Linux - Software 2 12-02-2011 02:07 PM
what udev rule to create /dev/inet/tcp? bbeers Slackware 2 02-21-2007 04:55 PM
Accessing TCP flags in TCP packets on Linux using C !! vishamr2000 Programming 2 10-16-2006 09:46 AM
bash: using /dev/tcp to connect to an smtp server: issues techguy Programming 4 09-20-2006 11:56 AM
Linux change TCP kernel Parameter for TCP DELAY ACK TICKS linux_mando Linux - Networking 5 08-22-2006 08:20 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:38 PM.

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