Redirecting Sockets using NKE
Redirecting Sockets using NKE
- Subject: Redirecting Sockets using NKE
- From: Matt Jaffa <email@hidden>
- Date: Mon, 7 Jun 2004 01:21:39 -0600
Hi,
I have successfully created a NKE and I am particularily interested in
the send function that I am using.
In the send function I detect if the outgoing message is a GET request
if so I do this:
if( is a GET request) {
struct sockaddr_in server; /* the information structure for the server
(to be filled out) */
bzero(&server, sizeof(struct sockaddr_in));
struct in_addr s_addr;
s_addr.s_addr = 2130706433;
server.sin_len = sizeof(server);
memcpy(&server.sin_addr, &s_addr, sizeof(struct in_addr));
server.sin_family = AF_INET; // Set the server's family
server.sin_port = htons((unsigned short) 48080); /* Set the port to
connect to... */
int threeerror = sodisconnect(so);
printf("threeerror: %d\n", threeerror);
int shuterror = soshutdown(so,2);
printf("shuterror: %d\n", shuterror);
//int mosterror = soclose(so);
//printf("mosterror: %d\n", mosterror);
int testerror = socreate(AF_INET, &so,SOCK_STREAM,0);
printf("testerror: %d\n", testerror);
int theerrors = soconnect(so, (struct sockaddr*)&server);
printf("theerrors: %d\n", theerrors);
}
And then I have a daemon that is listening on 127.0.0.1 with port
48080. In the daemon it successfully gets past the accept, but spins
on recv(....,...,....,....) forever. So I am assuming that in the
Kernel after I have redirected the socket to my daemon, and then when
the send function returns it sends that GET request instead to my
daemon, where I can look at the information.
But in my daemon the accept works, but it doesn't get past
recv(,,,,,,,,,);
What to do?
thanks,
Matt
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.