Retrieve client ip address and port number in kernel udp socket
I am writing a simple client server udp program.
The server runs at the kernel level and client runs at application level. The client sends the request packet to server through "sendto(server_sock, buf, BUFLEN, 0, (struct sockaddr *)&server_addr, addr_len);" function and the server at the kernel level receives the message through "sock_recvmsg(server_socket, &msg, size, flags);". my doubt is how to retrieve the client IP address and port number at server side. |
Hi Yethish,
I'm sorry I didn't notice your question has not been answered yet. If you still need it, here is a suggestion: Code:
#include <sys/socket.h> |
Retrieve client ip address and port number in kernel udp socket
Hi tBrand,
Thanks for the response. The code suggested by you is for kernel level or application level ? Because at kernel level we use sock_recvmsg() call to receive the data, but in your code there is recvfrom() call to receive the data. I am looking for the solution at kernel level. Regards Yethish |
For a qn like this, I'd recommend asking the Mods via the Report button to move this to the programming forum.
You may also find this useful http://beej.us/guide/bgnet/. Not sure if it does the kernel level version. |
Sorry, Yethish, I didn't read your post carefully enough. I'll do a little experimenting and see if I can find something. I would like to know the answer myself.
|
All times are GMT -5. The time now is 05:21 PM. |