Need a starting point. I want to create my own network program for multiple OSes
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Need a starting point. I want to create my own network program for multiple OSes
I need help find a starting point as to go about this.
I have some novice to intermidiate progamming skills from a past life. What I want to do is create a program and run it on two seperate computers to just get them communicating together over the network on a basic level. I would like to do this in a language that doesn't limit me to a specific OS, this way I can have a linux and windows computer talking. However, I would prefer a language that can be useful down the road as well. My second inspiration, next to networking, is web design and web programming, which I hope to dig into as well eventually.
I'm not aiming to do anything overtly-complicated. One example that comes to mind would be a program that forwards any typed characters on one computer over the network and displays them on the other, and vice-versa.
I guess the program would run over TCP/IP. However, it would be nice to learn how to do this in a language that not only works on multiple OSes, but also has the ability to allow me to program my own communication protocol, aside from TCP/IP, down the road.
My intention with all this is to learn some network programming for fun.
I don't have to know everything.Any help at all is appreciated.
I need help find a starting point as to go about this.
I have some novice to intermidiate progamming skills from a past life. What I want to do is create a program and run it on two seperate computers to just get them communicating together over the network on a basic level. I would like to do this in a language that doesn't limit me to a specific OS, this way I can have a linux and windows computer talking. However, I would prefer a language that can be useful down the road as well. My second inspiration, next to networking, is web design and web programming, which I hope to dig into as well eventually.
I'm not aiming to do anything overtly-complicated. One example that comes to mind would be a program that forwards any typed characters on one computer over the network and displays them on the other, and vice-versa.
I guess the program would run over TCP/IP. However, it would be nice to learn how to do this in a language that not only works on multiple OSes, but also has the ability to allow me to program my own communication protocol, aside from TCP/IP, down the road.
My intention with all this is to learn some network programming for fun.
I don't have to know everything.Any help at all is appreciated.
C and C++ are the most common ones to use. Work fine on Linux, Mac, and windows, along with others (BSD, BeOS, etc.).
Thanks. Does anyone know of any good network programming tutorials or books with a lot of hand-holding for beginners like me?
Well the great thing about Java is that the entire API documentation is available online at the sun website and includes a whole load of tutorials, as well as a forum where you can ask other java programmers for help.
If I were to learn network programming using either of these language, how closely will those techniques transfer over to the other language? For example, if I learn how to open and close connections, and transfer data over the network, is it pretty easy to do it the same in the other language? Or is it a totally different beast in each?
One thing that just popped into my head is PHP. How well can that do network programming and how does it's technique compare to that of Java or C/C++? The reason why I ask is because I have access to my website here from work, so I actually upload some code to it while I'm here. I always looked at PHP as being nothing more than a server-side language. How can it be used for network programming in that case?
If I were to learn network programming using either of these language, how closely will those techniques transfer over to the other language? For example, if I learn how to open and close connections, and transfer data over the network, is it pretty easy to do it the same in the other language? Or is it a totally different beast in each?
One thing that just popped into my head is PHP. How well can that do network programming and how does it's technique compare to that of Java or C/C++? The reason why I ask is because I have access to my website here from work, so I actually upload some code to it while I'm here. I always looked at PHP as being nothing more than a server-side language. How can it be used for network programming in that case?
Not all that familiar with PHP outside of the scope of webpages, sorry.
As for the other part... it's hard to explain! The actual process of establishing a connection or listening for an incoming connection on a socket, sending or receiving data and acting on it is similar in as much as you do the same thing in both languages. What differs is the WAY you do those things. I'm not sure that makes any sense.
I guess what I mean is you program's flow control would look the same in either language, but you would use different classes and methods to achieve your goal. However, in both cases you would set up some sort of listening socket, you'd receive data on that socket and you'd process it (or for the sending computer, you'd open a connection to a socket at a host and write data to that socket).
I don't think I've explained myself well.
In Java creating a socket and writing data is as simple as:
Code:
Socket s = new Socket("host.name.com", 6969);
DataOutputStream os = new DataOutputStream(s.getOutputStream());
s.write("write some data");
and on the host machine you'd similarly set up a ServerSocket object to listen for incoming connections and maybe poll for incoming data every so often.
So is there any big limitations in performance or capabilities in choosing java over c/c++? For example, could I create a java firewall program that blocks particular ports and forwards the rest of the connections out another nic? Could I also create a proxy using java and have it filter certain urls before forwarding the rest out a second a nic? Basically, run a program on an extra computer with two network cards to create my own proxy and firewall? If java is capable, is there any big disadvantages with taking the java route to doing this?
So is there any big limitations in performance or capabilities in choosing java over c/c++? For example, could I create a java firewall program that blocks particular ports and forwards the rest of the connections out another nic? Could I also create a proxy using java and have it filter certain urls before forwarding the rest out a second a nic? Basically, run a program on an extra computer with two network cards to create my own proxy and firewall? If java is capable, is there any big disadvantages with taking the java route to doing this?
It's a toss up, really. C++ has better performance than Java, but actually these days the old "Java is sloooowwww" thing is really a myth. The latest JVM is starting to really get close to C++ where performance is concerned. C (not C++) is still the fastest, but then suffers from being much harder to get going in the first place (I had to buy a book to even start socket programming in C).
On the other hand Java does make the task quite easy because there are existing classes for virtually everything you'd need to do.
Perhaps it would be an idea for you to start by researching a bit of each language? Maybe search for "socket programming in C++" and "socket programming in Java" and see what you think.
Sounds like a good idea. My main goal is to have fun while gaining a better understanding of how the lower levels of a network operate, but I'm not gonna have fun if I can't get my computer to talk with another; would it be worth looking into a "socket programming in C" book or does that sort of thing get way too complicated?
If your requirement is to have fun while learning, then I would definitely recommend doing Java first - because as has been said it does provide a lot of help for things that you might want to do.
Once you've got that mastered, then I would get a socket programming in C book, so that you can see "how the other side" do it. There's nothing like comparing two ways of doing things to really learn about a subject.
Then you can try writing a network server in one language, and the client in the other and explore the wonders of interoperability!
Sounds like a good idea. My main goal is to have fun while gaining a better understanding of how the lower levels of a network operate, but I'm not gonna have fun if I can't get my computer to talk with another; would it be worth looking into a "socket programming in C" book or does that sort of thing get way too complicated?
Unless you're actually planning on learning C I wouldn't bother. C++ maybe, but not C.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.