Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

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. 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
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

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

http://www.libssh.org/

share|improve this answer
add comment