Hi.
I have to send UDP packets very often. Approx twice in a second.
But socket is not closed after sending packet. So soon i bump into
open sockets\files limit.
How to close socket after sending data?
Python 2.5, Twisted
class DataClient(Data gramProtocol):
def __init__(self, address, datagram = "PONG"):
self.address, self.datagram = address, datagram
def startProtocol(s elf):
self.transport. socket.setsocko pt(socket.SOL_S OCKET, \
socket.SO_BROAD CAST, True)
self.transport. connect(self.ad dress[0], self.address[1])
self.sendDatagr am()
def sendDatagram(se lf):
self.transport. write(self.data gram)
debug("Data client: Sending to %s" % repr(self.addre ss))
while True:
clientprotocol = DataClient(("25 5.255.255.255", 5999), data)
reactor.listenU DP(0, clientprotocol) .stopListening( )
knight@rknb:~$ ls -la /proc/15429/fd/ | wc -l
43
knight@rknb:~$ ls -la /proc/15429/fd/ | wc -l
44
knight@rknb:~$ ls -la /proc/15429/fd/ | wc -l
44
knight@rknb:~$ ls -la /proc/15429/fd/ | wc -l
44
knight@rknb:~$ ls -la /proc/15429/fd/ | wc -l
45
knight@rknb:~$ ls -la /proc/15429/fd/ | wc -l
45
knight@rknb:~$ ls -la /proc/15429/fd/ | wc -l
46
Thanks in advance. 0 1165 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Diez B. Roggisch |
last post by:
Hi,
I have a simple client-server app, that sits on a serial port and
communicates through that with an attached microcontroller-board. To the
outside, it exposes two sockets (file or inet) which can be connected by
clients to perform certain tasks like uploading programs, giving me a
console and resetting the board. So far, I've used threads - every incoming
connection generates one that will listen to the client socket using...
|
by: mir nazim |
last post by:
hi,
i m planning to start writing intranet applications and want ur real
cool advices for choosing the correct platform. the choice is between
the three:
1. Twisted
2. Medusa
3. Zope
(i do not know any of the three).
|
by: Tim Gosselin |
last post by:
I am writing a tcp tunnel but cannot find a way of detecting when a socket
shuts down its read end without writing to the socket. For testing the
write end of the remote endpoint I just do a:
if not sock.recv(buffsize)
I cannot write to the socket and check if send returns 0 though, because
that involves sending data out of the which may not have come in yet.
When I try polling the socket with:
|
by: DreJoh |
last post by:
I've read many articles on the subject and the majority of them give the same
solution that's in article 821625 on the MSDN website. I'm using the
following code and when a the client disconnects the child socket remains in
the CLOSE_WAIT state. Anyone have any idea what's missing?
----------------------------- Socket Code -----------------------------
namespace Sockets
{
#region Class - SocketClient
|
by: Dr. J |
last post by:
I have an application that opens a socket and connects to another
application listening over a port. The problem I am encountering is that
when the listening application is closed my application cannot detect it to
take appropriate action. I am using "Connected" property of the Socket
class, but it seems this property does not reflect the true state of the
socket connection.
Here is the code snippet. Basically, I am checking the...
| |
by: Droopy |
last post by:
Hi,
I try to implement a reusable socket class to send and receive data.
It seems to work but I have 2 problems :
1) I rely on Socket.Available to detect that the connection is closed (no
more data to expect). Sometimes, Socket.Available returns 0 but the other
end of the connection did not close it !
2) This class will be used by many other classes so I have to use the
|
by: hazz |
last post by:
smtpClient.Send(message)
is causing me problems as per specifics in the trace below. Email is sent
but not without this error typically upon sending the second email, but
sometimes when running the app, even the first time. The application will
be required to be sending out repeated emails, about one every second or
two.
Must this be done asynchronously? Thank you. -Greg
I get the generic error messages;
|
by: billiejoex |
last post by:
Hi there.
I'm setting up test suite for a project of mine.
situations, if the socket is closed on the other end or not.
I noticed that I can "detect" such state if a call to socket.read()
returns 0 but it seems a little poor to me. :-\
Is there a reliable way to test such socket 'state'?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |