Page 1 of 1

Bandwidth Control

Posted: Sun May 09, 2004 8:00 pm
by luke101
Is there a way to control bandwith of a file being transfered in purebasic

Posted: Sun May 09, 2004 8:36 pm
by fweil
...,

Do you mean transfered using a network or from disk ?

Posted: Mon May 10, 2004 2:27 am
by luke101
i will be trying to control bandwidth on a network

Posted: Mon May 10, 2004 6:17 am
by Doobrey
Dunno if this is any help to you, I use the following procedure instead of SendNetworkData() for sending at a controlled rate.

Code: Select all

Procedure.l SendNetworkDataLimited(client.l,buffer.l,size.l)
 Shared MaxRate.l
  
  time.l=TimeGetTime_()
  sentbytes.l=SendNetworkData(client,buffer,size)
  time.l=TimeGetTime_()-time
  
  delaytime=((sentbytes*1000)/MaxRate)-time

  If delaytime>0
   Delay(delaytime)
  EndIf
  
 ProcedureReturn sentbytes
EndProcedure
Just remember to set MaxRate (in bytes/second) somewhere in your code.

Posted: Mon May 10, 2004 1:20 pm
by luke101
I wanted to control the bandwidth thats outside of the purebasic program.

for instance my brother loves downloading songs and sucking up all the bandwidth. I want to put a program on his computer slow his bandwidth down while im on the internet.

Is this possible

Also wanted to find out if there was a way to block certain websites in purebasic??

Posted: Mon May 10, 2004 3:16 pm
by Jose
@luke101
Sounds like what you want is a proxy server, this you could create using PB, but a lot of knwledge and work to do it, its not just single network commands etc.

Search for FREE proxy servers on the Internet.

hope that helps

Posted: Mon May 10, 2004 6:55 pm
by blueznl
proxy doesn't help, use this program on a gateway: bandwith controller, it's not free though

alternative: there are some progs that run on the client and cap the up / down, but... only if your brother runs them on his machine :-)

to write such a beast in purebasic would be quite a challenge i assume...

Posted: Tue May 11, 2004 1:34 am
by Shannara
IF you guys are sharing a net connection, and are using a good router/switch, you can limit bandwidth/speed of a MAC address (which is on his ethernet card). Just need to see if your router/switch have that option and get your brother's MAC address.

Of if your router do such a thing as assign addys to computers connected to it, you could try it that way...

Posted: Tue May 18, 2004 4:39 am
by PB
> my brother loves downloading songs and sucking up all the bandwidth.
> I want to put a program on his computer slow his bandwidth down while
> im on the internet.

Which app is he using? Most file-sharing apps have a built-in bandwidth
limiter that you can use... set it to something small instead of the max.

Posted: Tue May 18, 2004 5:59 pm
by Mr Tickle
Along similar lines I'd like to know if it's possible to make a bandwidth monitor for all downloads so that I can tell if I get near to my bandwidth limit of 20Gig.

Posted: Wed May 19, 2004 6:48 pm
by thefool
you talk about blocking certain web sites. You could mess with his host-file. That file change reference of the network i think. I mean: If hees trying to reach www.google.com and you have an entry in the host file looking like this: http://www.google.com about:blank
a blank page will come up. change the about:blank with http://www.purebasic.com that page will come up. find your host file in the window system32 or system directory somewhere-