log send, sendrec, recv and notify system calls


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers log send, sendrec, recv and notify system calls
# 1  
Old 02-04-2008
log send, sendrec, recv and notify system calls

Hi,
I've a question about MINIX OS.

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 OS, 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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A notify-send Question --

Greetings. I've come across a bit of a problem with notify-send syntax; and wondered if anyone out there had found a solution in the woodpile somewhere :) Here's the snippet which is giving me trouble:notify-send 'Text to display' image_data 300, 300, , , , , /etc/image.pngOutput:Invalid... (0 Replies)
Discussion started by: LinQ
0 Replies

2. Shell Programming and Scripting

[linux] tail2notify - script interface between tail -f + grep and notify-send

This isn't exactly a question. Just thought I'd share something I just wrote and found useful. For those of you on modern linux boxen: you may be aware that there's a lovely little tool called notify-send that you can use to send notifications to the desktop. Any experienced shell-scripter could... (0 Replies)
Discussion started by: ryran
0 Replies

3. UNIX for Dummies Questions & Answers

system calls in C

Hello, how would i be able to call ps in C programming? thanks, ---------- Post updated at 01:39 AM ---------- Previous update was at 01:31 AM ---------- here's the complete system call, ps -o pid -p %d, getpit() (2 Replies)
Discussion started by: l flipboi l
2 Replies

4. Shell Programming and Scripting

notify-send does not notify real time

Hi, I am having a little trouble getting notify-send to work the way I would like it to. I am using ubuntu - karmic koala 2.6.31-19-generic #56-Ubuntu SMP So here's the problem run the following commands one after the other. notify-send -i info -t 100000 -- "Hi" "world" & notify-send -i... (3 Replies)
Discussion started by: linuxpenguin
3 Replies

5. Programming

ABOUT RECV() SYSTEM CALL (regarding timer)

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any... (0 Replies)
Discussion started by: Rohil
0 Replies

6. Programming

System calls

why user is not able to switch from user to kernel mode by writing the function whose code is identical to system call. (1 Reply)
Discussion started by: joshighanshyam
1 Replies

7. UNIX Desktop Questions & Answers

Using system calls

Hi, I'm new to UNIX system calls. Can someone share your knowledge as to how exactly system calls should be executed? Can they be typed like commands such as mkdir on the terminal itself? Also, are there any websites which will show me an example of the output to expect when a system call like... (1 Reply)
Discussion started by: ilavenil
1 Replies

8. Programming

UDP socket - can both client and server recv and send

Hi, Am very new to socket programming. When we use UDP sockets to communicate between two processess, will both the client/server socket be able to send/recv ? meaning can sendto()/ recvfrom() be used on both server and client? It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies

9. Programming

send and recv ARP package in AS3.0

In attachment, is the code to test IP by ARP proxy. I always use it to test a IP already existing in my cluster. Usage: arp_func eth0 192.168.1.1 Enviroment: IA64, RedHat AS3.0, 2.4.21-15.EL, gcc-3.2.3-34, "gcc -o arp_func arp_func.c" When the code below added before... (0 Replies)
Discussion started by: lameryang
0 Replies

10. UNIX for Dummies Questions & Answers

System calls for cp and mv

Which system calls are made for operations cp and mv (2 Replies)
Discussion started by: gaurava99
2 Replies
Login or Register to Ask a Question