LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.

Notices

Reply
 
Search this Thread
Old 02-04-2008, 03:46 PM   #1
xeon123
Member
 
Registered: Sep 2006
Posts: 364

Rep: Reputation: 16
log send, sendrec, recv and notify system calls


Hi,

1 - I would like to log the messages that user or kernel process send to each other through the system call send, recv, sendrec and notify.
Since MINIX is a microkernel, I suppose that the best way is to have an TCP socket, listening in INADDR_ANY address. But, I don't know which port should I use. Can anyone help me?

2 - I've the following code:

Code:
int main(void)
{
	int sockfd, new_fd;  // listen on sock_fd, new connection on new_fd
	struct sockaddr_in my_addr;	// my address information
	struct sockaddr_in their_addr; // connector's address information
	socklen_t sin_size;
	struct sigaction sa;
	int yes=1;

	if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
		perror("socket");
		exit(1);
	}
(..)
my_addr.sin_family = AF_INET;		 // host byte order
	my_addr.sin_port = htons(MYPORT);	 // short, network byte order
	my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP
	memset(my_addr.sin_zero, '\0', sizeof my_addr.sin_zero);

	if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof my_addr) == -1) {
		perror("bind");
		exit(1);
	}

(...)
}
But I get the error that, "Address family is not supported". I don't understand why?

Thanks,
Pedro
 
Old 02-04-2008, 05:26 PM   #2
xeon123
Member
 
Registered: Sep 2006
Posts: 364

Original Poster
Rep: Reputation: 16
The error, is in bind method. the reason is, because my_addr.sin_family = AF_INET;. I don't understand why I get this error.
 
  


Reply


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
Infomration regarding the send() and recv() function karimasif Linux - Networking 1 01-13-2008 10:49 AM
send log messages to another system anurag1510 Red Hat 7 10-11-2005 06:19 AM
Which virtual machine can be used to emulate RH 7.3 on PIV to log system calls nedianz Linux - Security 1 03-14-2005 08:07 AM
which virtaul machine to use to log system calls by privileged proccesses nedianz Linux - Newbie 1 03-14-2005 06:10 AM
Which virtual machine can be used to emulate RH 7.3 on PIV to log system calls nedianz Linux - Software 0 03-14-2005 05:36 AM


All times are GMT -5. The time now is 08:29 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