Connecting with a specific interface in Linux [closed] - c

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have connected two ethernet cards in the CPU. I have then connected one card to internet another one card to the modem. Its working fine. from modem i have connected to another linux pc.when i m ping the another pc ip address from my machine its not pinging.how to configure it

If you have two interfaces, you have two IP addresses.
Bind your socket to the IP address/port you want to use.
You can read this socket tutorial for operations step by step on Linux.

Related

Is socket programming what I need? [closed]

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 6 years ago.
Improve this question
So I'm developing a 2d game using sdl1.2 on linux as a part of a college project and I need the player to be able to submit his score to know his ranking against other players who played the game aswell and I was wondering what am I going to need in order to achieve this with C, is socket programming the answer?
Thank you.
Yes, if your concern is about the communication, then socket is the only way, of course there are easy to use wrappers around socket, like zeromq etc.
The server would create a server socket and listens on it, and each client will connect to this server and then send the scores and any other data necessary to the server.
For data persistent, you can use embedded database like SQLite or leveldb etc.

How to get remote host MAC address by using its ip address in c programming in linux [closed]

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 7 years ago.
Improve this question
Can some one tell me, how to get remote host MAC address by using its ip address in linux by using c programming(could be netlink sockets or BSD sockets)?
This can't be done using C programming. If it was possible then there wouldn't be any protocol like ARP to get the link layer address.
You can implement ARP request and reply using socket programming. But that's not what you want in this case I think. Anyway in that case you can refer to this discussion
link.
You can have a look at this for that purpose source code.

Capture packets at ethernet port in C language [closed]

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.

How NTP protocol works? [closed]

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.

Unable to create socket: Operation not permitted - Mac [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm trying to run portscaner as part of my work at school. When I run the code it shows an error msg "Operation not permitted". This msg is printed directly after the OS fails to create a socket.
Notes:
1. my system is Mac OS X 10.6.8
2. in this project I'm using row socket.
3. I've written a code before the creates TCP socket and runs perfectly.
I assume this error appear because row sockets require some kind of higher privilege that my system currently has. Does anyone know how to change the privilege in my system?
Any helps is highly appreciated :)
Thanks
The process has to have root privileges to open a raw socket.
Some time another socket is running under the same port

Resources