Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question

migrated from 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. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the 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

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.

share|improve this answer

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

share|improve this answer

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

share|improve this answer