I have two linux PC and connected through LAN cable.First PC having internet connection but second does not.I want second PC to use the connection of first PC through a C program.

I am new to network programming.Any help will be appreciated.Please suggest where to start.

THNX.

link|improve this question
There's no need to write a program to do this. What you need to do is bridge the connection between the two computers. There are several posts on Super User about this already: How to share internet connection in Ubuntu, Share internet in Linux, Bridging network connections in Linux. – nhinkle Sep 17 '11 at 18:59
feedback

migrated from stackoverflow.com Aug 29 '11 at 7:36

This question came from our site for professional and enthusiast programmers.

closed as not a real question by nhinkle Sep 17 '11 at 18:57

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. See the FAQ for guidance on how to improve it.

3 Answers

Do you want your C program to be able to access internet through another PC? Or you want to develop a utility using which any C program can do such thing? If former you must look into existing facilities on linux for sharing connections. See this link for example.

The point is, unless you want to write network utilities, your C program -- or any other program for that matter -- should use whatever internet connection is available on the host computer. For general programs the detail of how the host computer connects to internet is irrelevant.

link|improve this answer
feedback

You need to look into some sort of source programs such as 3proxy

link|improve this answer
feedback

If you want to forward connection over a secure connection, use tcpip forwarding of SSH.

http://www.libssh.org/

link|improve this answer
feedback