LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 05-16-2012, 06:09 AM   #1
smilebhuff
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
#define __FDSET_LONG (__FD_SETSIZ/__NFDBIT)
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;
FD_ZERO(&listen_set);
socket_id = t_open("/dev/tcp", O_RDWR|O_NONBLOCK, (struct t_info *) 0);
if ( socket_id <0 )
{
exit(FAILURE);
}
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
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,676

Rep: Reputation: 487Reputation: 487Reputation: 487Reputation: 487Reputation: 487
What this program is supposed to do?
 
Old 05-17-2012, 04:40 AM   #3
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,607

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

here is a linux socket tutorial: http://www.linuxhowtos.org/C_C++/socket.htm, but I think you can find a lot of information yourself.
 
  


Reply

Tags
linux


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


All times are GMT -5. The time now is 01:10 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration