Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to capture packets which are coming from interface (say eth0) and need to print those packet details (same as wireshark) through C language. Packet can be any general packet. is there any way to achieve this ??
(I don't want to use any application like wireshark for this purpose)
OS:Centos
Try having a look at libpcap. http://www.tcpdump.org/ I believe it will do what you want.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I was wondering how does the C or ASM code from kernel communicate with network card. I can't find this anywhere. Like when I would write my own kernel , and wanted networking how would I go about that, would I need to have separate code for each networking card that exists?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have question about connection to Redis server via URL. How can I do that in C code?
I tried to find something about that but it seems every one use for connection IP and port.
Without more details it's hard to give a detailed answer. But your question iplies that you know how to connect by ip, and if you have an url, it's easy to get the ip from dns. You only need to build a wrapper of some kind.
return_type myRedisWrapper(const char* url) {
char ip[16];
extractIpFromUrl(url, ip);
return redisLibFunction(ip);
};
So you only have to implement extractIpFromUrl which should be fairly simple.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How to capture packets delivered to my Ethernet port but are discarded because they do not have the same MAC address as my Ethernet card?
I am trying to develop a program in C language. Hence require pointers on how the above can be achieved?
I am trying to do this in Linux.
Under Linux you may use libpcap library. This is the easiest way. You may also do it "by hand" using appropriate socket type (sock_packet, sock_raw) with promiscuous mode for ethernet interface. Google for "linsniff.c" program if you are looking for example.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I try to find ant NTP documentation for "dummies", I don't understand how NTP works. I need to write an NTP client which should just print current local time. What should I send to the server? What will I receive?
If you want to implement your own client then you need the RFC 5905 - Network Time Protocol Version 4 which specifies the protocol and algorithms of NTP. This document describes exactly what you should send to the server and what you will receive.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I could not find any code samples using Google. Could someone please show me how to do it? I think we need to use winsock or wininet.
You didn't search that much...
recv function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms740121(v=vs.85).aspx