IP blocking or MAC address blocking

Reply

Join Date: Oct 2007
Posts: 15
Reputation: awo is an unknown quantity at this point 
Solved Threads: 1
awo's Avatar
awo awo is offline Offline
Newbie Poster

IP blocking or MAC address blocking

 
0
  #1
Dec 20th, 2008
Is there any class in java or a package that one can use to manage IP configuration.
I mean i was planing to develop a cafe timing application that allows people to bring in there computer system and it will not allow the client system to browse when their time expires. And I want it to run on the server so there wont be need to have the application on the client system
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 706
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 84
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: IP blocking or MAC address blocking

 
0
  #2
Dec 22nd, 2008
haven't heard of a standard api that does that, but there's no-one to hold you back and write it.
let your client retreive the ip-address, send it to the server.
to let the client disconnect when "time expires", you could :
a. let the client run a thread which continously checks with the server wether or not it has expired, or, you could go the way I would
b. let the server send a disconnect-command to the client, based upon the time of login.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,177
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 481
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: IP blocking or MAC address blocking

 
0
  #3
Dec 22nd, 2008
You can have look on java.net package, but there is not too much to it
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: IP blocking or MAC address blocking

 
0
  #4
Dec 22nd, 2008
According to me the MAC-Address comes into play at the Data Link Layer, whereas Java can go down only till the Transport Layer. One of the reasons why I had read "ping" cannot be written in Java.
Last edited by stephen84s; Dec 22nd, 2008 at 6:49 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,177
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 481
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: IP blocking or MAC address blocking

 
0
  #5
Dec 22nd, 2008
Ping cannot be accessed directly you can use Runtime to execute console ping command and read it in, but this is awkward solution
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: IP blocking or MAC address blocking

 
0
  #6
Dec 22nd, 2008
Originally Posted by peter_budo View Post
Ping cannot be accessed directly you can use Runtime to execute console ping command and read it in, but this is awkward solution
I actually meant implementing the "ping" utility completely in Java (note: not just invoking a ready to use implementation) is not possible, cause Java runs mostly on the Application or Transport layer.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,600
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 462
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: IP blocking or MAC address blocking

 
1
  #7
Dec 22nd, 2008
Saying that 'XXX is not possible in Java' is pretty misleading IMO.

Is I/O and Networking possible in Java? You might say yes, there are packages like java.io.* and java.net.* for it. But is it really possible in *java*? Both I/O and Networking libraries which are part of the standard libraries at their core make JNI calls and are platform specific since the way I/O is performed is OS/platform specific. So as long as you have the proper JNI code in place along with dynamic libraries for your target platforms, almost anything is possible in Java. The same argument applies to 'Java only works at Application/Transport layer'.

But to answer the question, yes, a ping utiilty can't be written using the standard Java libraries, since AFAIK, Java doesn't allow creation of raw sockets which are needed to send ICMP packets.
Ping requires ICMP packets. These packets can only be created via a socket of the SOCK_RAW type. Currently, Java only allows SOCK_STREAM (TCP) and SOCK_DGRAM (UDP) sockets. It seems unlikely that this will be added very soon, since many Unix versions only allow SOCK_RAW sockets to be created by root, and winsock does not address ICMP packets (win32 includes an unsupported and undocumented ICMP.DLL).
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: IP blocking or MAC address blocking

 
0
  #8
Dec 22nd, 2008
So as long as you have the proper JNI code in place along with dynamic libraries for your target platforms, almost anything is possible in Java
Yep, Hard to disagree with that one, I guess should have mentioned
the Standard Java Library.

But being a Java programmer I did love the statement :-
almost anything is possible in Java
Thanks for the information on raw sockets ~s.o.s~, All I had known was Java (the core networking APIs of Java) works with TCP/IP or UDP Sockets and that Ping works with ICMP, never knew why they couldn't mix.

Also when I read some material on Raw Sockets, I noticed that the packets arriving on them bypass the normal processing on the TCP/IP Protocol stack (by the kernel), So **I guess** we can actually drop down not only to the Network layer, but also access the Data Link Layer headers here.
Thanks again, discovered another new thing today and Sorry for hijacking your thread awo.
Last edited by stephen84s; Dec 22nd, 2008 at 11:49 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,600
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 462
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: IP blocking or MAC address blocking

 
0
  #9
Dec 22nd, 2008
The view presented by the Java programming language for anything networking related is too high level/abstract [which is a good thing from productivity POV].

Writing networking code in C is probably the best way of hacking around with the core networking protocols and to see how the things really work; something which has been on my TODO list for quite some time. :-)
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC