Limiting internet usage of a java application

Hi,

I am trying to develop a java application that will indeed need the use of the internet a lot (a web spider). However my school doesn't permit me to use the program with the all capabilities because it really damages the overall internet. So is there a class/command/ or code that can limit the internet usage of java to a pre specified value (like 120 kbs./sec.) All help will be appreciated, thanks in advance....

Regards....

[451 byte] By [protennisera] at [2007-11-27 11:58:48]
# 1

i suppose you could monitor the outgoing/incoming stuff and limit it in whatever way you want, but i'd try to find another piece of software/hardware to do this and not do it in java.

SoulTech2012a at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 2

so it is you who broke the internet last week! fuckface!

mkoryaka at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 3

one way to do this is to get another app to do this for you, this is the best way

another way is figure out how much BW your app will eat, take that number and add sleeps into your crawling/spidering so that over 1 mins your app is using the internets for only 30/seconds, now you are using 1/2 the BW! yey!

thats a pretty gay way though, but only one i can think of right now

mkoryaka at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 4

Hi,

The computer I am running the application is a general computer that işs used by more than one person so I am not able to use another kind of software that will block the internet since it will block the other users too, so if there is a code that you can give an example of that will be superb.

protennisera at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 5

Himmmm,

That will indeed make the code a lot clumsy and since I implemented it multi-threaded more than some sleep sentences need I think. However if java can return me the BW I am using I think it should have the capability of limiting that BW too.

PS: I have nothing to do with your internet, believe me ;-)

protennisera at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 6

> PS: I have nothing to do with your internet, believe

> me ;-)

>However my school doesn't permit me to use the program with the all >capabilities because it really damages the overall internet.

your lies are transparent

mkoryaka at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 7

I really couldn't understand wither you are joking or not. What is the connection with my school's internet and you internet? Or even there is some I couldn't really have the permission to test the program in the school so I couldn't understand your problem.

protennisera at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 8

Intranet

Internet

To-may-to

To-mah-to

BigDaddyLoveHandlesa at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 9

you have your own internet? sweet!

does your internet have as much porn on it as mine?

mkoryaka at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 10

> you have your own internet? sweet!

> does your internet have as much porn on it as mine?

This isn't the place to post a link to my video on youporn, is it?

BigDaddyLoveHandlesa at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 11

> Intranet

> Internet

>

> To-may-to

> To-mah-to

I didn't understand anything?!!!

protennisera at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 12

> you have your own internet? sweet!

> does your internet have as much porn on it as mine?

Is there a problem bro? I do think too this isn't a place to post such messages. So if you don't wanna help please don't disturb too.

protennisera at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 13

no problems! i just want to know how you broke my internet with your internet, and how much porn your internet has and what kinds, because i am running out of it on my internet

mkoryaka at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 14

am i disturbing your internet? my 2nd post might help you.

mkoryaka at 2007-7-29 19:21:52 > top of Java-index,Java Essentials,Java Programming...
# 15

> no problems! i just want to know how you broke my

> internet with your internet, and how much porn your

> internet has and what kinds, because i am running out

> of it on my internet

Ok, since it is proven that you are helpless I am not interested any of your messages from now on.

protennisera at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 16

are you going to put a firewall around your internet blocking my internet?

mkoryaka at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 17

****, i cant see his messages! i think he blocked my internet! HELP!

mkoryaka at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 18

> ****, i cant see his messages! i think he blocked my

> internet! HELP!

I think you've just gone blind from too much porn.

BigDaddyLoveHandlesa at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 19

> > ****, i cant see his messages! i think he blocked

> my

> > internet! HELP!

>

> I think you've just gone blind from too much porn.

Nothing is better than a great joke ;)

protennisera at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 20

> > > ****, i cant see his messages! i think he

> blocked

> > my

> > > internet! HELP!

> >

> > I think you've just gone blind from too much porn.

>

> Nothing is better than a great joke ;)

WHAT DID YOU SAY?!!?! ITS ALL BLURRED

mkoryaka at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 21

Can you tell it's Friday?

BigDaddyLoveHandlesa at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 22

> Himmmm,

> That will indeed make the code a lot clumsy and since

> I implemented it multi-threaded more than some sleep

> sentences need I think. However if java can return me

> the BW I am using I think it should have the

> capability of limiting that BW too.

You can keep track of how many bytes you've read/written in the last N seconds, and every time you're about to read or write, if the average BW used over the last N seconds is more than the limit, then sleep long enough to bring it down under the limit.

jverda at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 23

> You can keep track of how many bytes you've

> read/written in the last N seconds, and every time

> you're about to read or write, if the average BW used

> over the last N seconds is more than the limit, then

> sleep long enough to bring it down under the limit.

Still painful, but could you give me a sample code that will learn how many bytes did I write or read?

That will be great.

protennisera at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...
# 24

> Still painful, but could you give me a sample code

> that will learn how many bytes did I write or read?

> That will be great.

Look in the docs for the streams, readers, and writers in the java.io package.

jverda at 2007-7-29 19:21:57 > top of Java-index,Java Essentials,Java Programming...