Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Create a VPN client in java  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,i have no knowledge of java networking. Am building a vpn using using java programming language. I would like to add some networking functions such that i can be able to connect to an http server via a specified port.

FULL DETAILS:

I want my program to be able to listen to incoming traffic from a certain port. A very good example is  vpn handler program. I've only created the program graphical user interface.
I want to create something like this>>SAMPLE

HERE IS MY SOURCE CODE










Please help
 
Java Cowboy
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

If you don't know anything about networking, then creating a VPN program sounds like a challenge.

I have a comment on the following in your code:

You are using some classes that you should not be using. Anything that is not in the API documentation of the JDK, such as classes in the com.sun.*, sun.* and jdk.internal.* packages are classes that are internal to the JDK and they should not be used directly.

If you use these classes, then there is a good chance that your program will not work anymore on any other version of Java than what you developed it on.

Oracle explains this here: Why Developers Should Not Write Programs That Call 'sun' Packages
 
Yusuf Abdullahi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jesper de Jong wrote:Welcome to the Ranch. . . .



i have knowledge of networking, but i dont have that of java networking.
If you have the knowledge of java networking, can i get to know you via whatsapp contact or any social media.
 
Marshal
Posts: 61750
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yusuf Abdullahi wrote:. . . can i get to know you via whatsapp contact or any social media.

No. All discussion shou‍ld be on the forum. Have you seen the Java™ Tutorials about networking?

And welcome again
 
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yusuf Abdullahi wrote:
i have knowledge of networking, but i dont have that of java networking.



If you already have knowledge of networking, then it should be easy to use the Java networking APIs.

The ServerSocket and Socket classes are used for TCP protocol (server and client side respectively). The DatagramSocket class is used for the UDP (over unicast) protocol. And the MulticastSocket class is used for the UDP (over multicast) protocol. Additionally, there are some convenience classes such as InetAddress class, that can be used for resolving interfaces, hostnames, etc. etc. etc.

Everything else, regarding networking, behaves the same, as it is mainly at the layer that Java sits on top of. All of the networking administration skills that you have, remain unchanged.

Henry
 
Yusuf Abdullahi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i get a code or something because i dont understand what they are saying when i opened the link.

I hope you understand my question?
 
Yusuf Abdullahi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:

Yusuf Abdullahi wrote:
i have knowledge of networking, but i dont have that of java networking.



If you already have knowledge of networking, then it should be easy to use the Java networking APIs.

The ServerSocket and Socket classes are used for TCP protocol (server and client side respectively). The DatagramSocket class is used for the UDP (over unicast) protocol. And the MulticastSocket class is used for the UDP (over multicast) protocol. Additionally, there are some convenience classes such as InetAddress class, that can be used for resolving interfaces, hostnames, etc. etc. etc.

Everything else, regarding networking, behaves the same, as it is mainly at the layer that Java sits on top of. All of the networking administration skills that you have, remain unchanged.

Henry



Dear Henry, am impressed can you explain further on the next step i should take.
 
Henry Wong
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yusuf Abdullahi wrote:
Dear Henry, am impressed can you explain further on the next step i should take.



I am not sure what you are asking about. As I mentioned (or perhaps, very strongly implied... ), Java networking is simply a wrapper layer on top of standard networking libraries. Heck, even the method names seems to have a one to one mapping to their OS counterparts.

Can you elaborate a bit? What do you want to do with networking (while making your VPN) -- that works with standard network APIs, but doesn't work in Java? Perhaps, it is something that Java haven't implemented correctly, and we can help you find a work-around.

Henry
 
Yusuf Abdullahi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:. . . Can you elaborate a bit? What do you want to do , , ,



I want to create something like this>>
 
Henry Wong
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Okay, I am going to imply from your last response that -- you are either asking about how to implement a proxy server, or a VPN, from scratch. If I am wrong, then I apologize, and please ask a specific networking question.

However, if I am correct, and you don't know how a proxy/VPN works, then I quote a previous response.

Jesper de Jong wrote:
If you don't know anything about networking, then creating a VPN program sounds like a challenge.



Henry
 
Yusuf Abdullahi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:. . .

Jesper de Jong wrote:. . . creating a VPN program sounds like a challenge.



Henry



I know much about proxy servers and vpn. The only problem is that i dont know how to integrate them into a java program. Need your help.
 
Henry Wong
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yusuf Abdullahi wrote:
I know much about proxy servers and vpn. The only problem is that i dont know how to integrate them into a java program. Need your help.



Well, unless something changed recently, I don't think that there is a standard API for VPNs. Please correct me if I am wrong in this regard.

So, as a first step, I would recommend contacting the company that makes the VPN, and see if there is a Java API that you can use. If not, then the next step would be to research the command line interface to the VPN. Perhaps the command line interface is rich enough to do what you want to do, and you can then programatically call the command line tools with the runtime exec() feature of Java.

Otherwise, you may be out of luck -- as the difficulty skyrockets after that. Sorry.
Henry
 
Yusuf Abdullahi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:

Yusuf Abdullahi wrote:
I know much about proxy servers and vpn. The only problem is that i dont know how to integrate them into a java program. Need your help.



Well, unless something changed recently, I don't think that there is a standard API for VPNs. Please correct me if I am wrong in this regard.

So, as a first step, I would recommend contacting the company that makes the VPN, and see if there is a Java API that you can use. If not, then the next step would be to research the command line interface to the VPN. Perhaps the command line interface is rich enough to do what you want to do, and you can then programatically call the command line tools with the runtime exec() feature of Java.

Otherwise, you may be out of luck -- as the difficulty skyrockets after that. Sorry.
Henry



I want to use OpenVpn. Would it be possible?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!