Hi folks,
I have a need in a network data distribution application to send out
data to folks who want it using the protocol of their choice. I´d
like it to support a variety of protocols and I don´t want to
implement any of them :-)
http, ftp (via ftplib) , https (dunno how yet), ssl, ssh, sftp (via
paramiko)
The thing is... I want rate-limiting so that in the case of a failure
of a single client
I don´t penalize the other clients, or if my server (which is acting
as a client pushing to remote servers.) goes down, it doesn´t saturate
the link when it comes back.
So I want to have all the protocols limit the number of bytes they send
per second.
It looks like the easiest way to do this is to dive into socket.py...
and look! it says:
# Wrapper module for _socket, providing some additional facilities
# implemented in Python.
note the ´additional facilities implemented in python´ ...
so we just add logic to:
-- add a ´maxrate´ argument to the constructor and/or an attribute to
modify the setting...
-- tally bytes, and time, and know when we are going ´too fast´
-- when too fast.. in the ´flush´ routine, in the synchronous case,
sleep for the correct time to come back under budget. in the async,
return without writing.
-- do something similar for reading.
Anybody think this would be fun? 3 2517
I looked at twisted briefly. It looks like it is server oriented.
Does it work in for clients initiating connections?
Jean-Paul Calderone wrote: On 16 Jun 2006 13:53:48 -0700, Peter Silva <pe*********@ec .gc.ca> wrote:Hi folks,
I have a need in a network data distribution application to send out data to folks who want it using the protocol of their choice. I´d like it to support a variety of protocols and I don´t want to implement any of them :-) http, ftp (via ftplib) , https (dunno how yet), ssl, ssh, sftp (via paramiko)
The thing is... I want rate-limiting so that in the case of a failure of a single client I don´t penalize the other clients, or if my server (which is acting as a client pushing to remote servers.) goes down, it doesn´t saturate the link when it comes back.
So I want to have all the protocols limit the number of bytes they send per second. It looks like the easiest way to do this is to dive into socket.py... and look! it says:
# Wrapper module for _socket, providing some additional facilities # implemented in Python.
note the ´additional facilities implemented in python´ ...
so we just add logic to: -- add a ´maxrate´ argument to the constructor and/or an attribute to modify the setting... -- tally bytes, and time, and know when we are going ´too fast´ -- when too fast.. in the ´flush´ routine, in the synchronous case, sleep for the correct time to come back under budget. in the async, return without writing. -- do something similar for reading.
Anybody think this would be fun?
Use Twisted instead. It supports every protocol you mentioned, and rate limiting too. Jean-Paul
Peter Silva <Pe*********@ec .gc.ca> wrote: I looked at twisted briefly. It looks like it is server oriented. Does it work in for clients initiating connections?
Twisted supports clients, servers, and "middleware " (proxies etc) in
equally wonderful and powerful ways.
Alex
Cool! Will check it out...
Alex Martelli wrote: Peter Silva <Pe*********@ec .gc.ca> wrote:
I looked at twisted briefly. It looks like it is server oriented. Does it work in for clients initiating connections?
Twisted supports clients, servers, and "middleware " (proxies etc) in equally wonderful and powerful ways.
Alex This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Abhishek |
last post by:
I have a problem transfering files using sockets from pocket pc(.net compact
c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to transfer data across.On the
serve I am using Socket 2 API (recv function to read bytes)and not using
..NET. I use FileStream to open the file on the pocket pc, then associate a
BinaryReader object with the stream and call ReadBytes to read all the...
|
by: Bob |
last post by:
Hi.
I'm developed a simple Transfer File program just to test the NetworkStream
class. I want to know how can i get the transfer rate speed.
Does someone know how to do it? And... what's the size limit for the
transfer buffer? I set the buffer size to 1MB. It's ok? This is the code:
private void TransferFile(Socket clientConnection, string fileName)
{
NetworkStream ClientBridge;
FileStream FileToTransfer;
|
by: mscdex |
last post by:
I have a server application that accepts file transfers (utilitzing
tcplistener) and was wondering how I would efficiently go about
determining the calculate transfer rate while I am transferring the
file. The Sub where the transfer actually takes place is called
asynchronously.
The (psuedo) code in the Sub goes something like this:
While byteCount < filesize
bytesRead = Bytes read from NetworkStream
|
by: David |
last post by:
I have googled to no avail on getting specifically what I'm looking for. I
have found plenty of full blown apps that implement some type of file
transfer but what I'm specifcally looking for is an example to follow for
using a tcp socket to transfer files between client/server, server/client.
Both server and client are my program so I'm not looking for how to
implement an FTP client, or how to download a file from a web server via
http...
|
by: raghubr |
last post by:
Hi all,
Can any one pls guide me through..I need to transfer the file from server to client and client to server using sockets in an Asynchronous mode so this file transfer doesn't hinder the common process of connecting and of the server and client...
here is the code i am trying to implement. this code snippet is for message transfer only for multiple clients.
/////////////////////////////file receive method when sent from...
| |
by: yashg |
last post by:
I am building a data backup application in C# using Sockets. It has a server component and a client component. The client is going to upload files to the server through TCP sockets. I've got all figured out and have been able to transfer files between client and server. Now I have some doubts about which is the best method to transfer a file? Option 1 - I use the built in Socket.BeginSendFile (I am using async calls) to transfer a file. Option 2...
|
by: Andrew Jackson |
last post by:
I am writing a newsgroup client. I have the protocol figured out. But I
get slow transfer speeds off any of the network objects read the data from
For example one of the commands for a news client to use is "XOVER
articlenumber-"
This return string after string of all the news articles from article number
on....
Another newsclient, i wont name names, pulls data down just fine. Using a
|
by: Dimitrios Apostolou |
last post by:
Hello list,
I want to limit the download speed when using urllib2. In particular,
having several parallel downloads, I want to make sure that their total
speed doesn't exceed a maximum value.
I can't find a simple way to achieve this. After researching a can try
some things but I'm stuck on the details:
1) Can I overload some method in _socket.py to achieve this, and perhaps
|
by: diegoblin |
last post by:
Hi, i kind of new to java and i want to transfer a file between a server and a client.
I know i have to use InputStream and OutputStream, but i don't know how to do it properly.
So far i think i've managed to do the client part. i read the content of a file, "hi.txt", and i send it to the server.
The problem is in the server part, i do not know how to write the file in the server. Thanks in advance for your help
Here is my code for the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |