Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
Softros LAN messenger 9.2
GetOrgChart 2.5.2
Alvas.Audio 2018.0
Bytescout PDF Viewer SDK 9.0.0.3079
SecureBridge 8.2
Magento Language Translator 1.0
Australia Post Shipping For Magento 1.0
Excel Add-in for SQL Server 1.7
ODBC Driver for BigCommerce 1.3
Excel Add-in for SQLite 1.7
SentiVeillance SDK Trial 6.0.183849
dotConnect for Dynamics CRM 1.7
Entity Developer 6.3
dbForge Documenter for Oracle 1.0
dbForge Data Generator for Oracle 2.0
Top Code
JustAjax Table 0.7
Vermilion 0.3.1
Splasher
VG CL Library 5.1
WP exec PHP 1.0
decision based median filter 1.0
weighted median filter 1.0
Top Rated
Output Messenger 1.8.0
Aliexpress Clone- Ec21 Script 1
Indiegogo Clone 3.0
Advanced MLM Software 1.2
Online Food Ordeing System 1.0
PHP Image Resize Script 1.0
Best Spotify Clone 1.0
Get Random Record Based on Weight 1.0.0
PHP Point of sale 10.0
Travel Portal Script 9.29
Excel Add-in for Bigcommerce 1.6
Magento Product Designer 1.0
OFOS - Just Eat Clone Script 1.0
PrestaShop Upload Images Module 1.2.1
Trading Software 1.2.4
When to not just use socket.close() 
File ID: 66187






When to not just use socket.close() 
Download When to not just use socket.close() http://code.activestate.com/recipes/496941-simple-readlines-in-reverse-wdeque/?in=lang-pythonReport Error Link
License: Freeware
Downloads: 4
Submit Rating:
When to not just use socket.close()  Description
Description: I have implemented a "broken" client/server to show how socket.shutdown can be more useful than a simple socket.close operation. (I rewrote this to hopefully be more clear)

The close operation is not atomic. It implicitly tries to send any remaining data in _addition_ to closing a descriptor. Splitting this close operation up with the aid of the shutdown command can help avoid bugs. It gives the server one final way to say, "something went wrong". The server would also know that the client did not end correctly, since the socket should remain open when the client finished sending data. For example, if the function exits unexpectedly and python closes the socket for you, the server would not be able to send any data back.

In the server below, the client and server have different ideas about what the end marker should be. The rev_end function is written so as to look for an end marker. And, as long as they agree it should work. The socket.shutdown is for when something goes wrong.

License: Freeware

Related: Network

O/S:Windows

Downloads: 4



More Similar Code

This recipe combines the delicious PageTemplates package with the flavorful Medusa package to serve up rendered PageTemplates from the file system.

Why not just use Zope you say? As far as I know, the current Zope release isn't an option with Python 2.2 code. The project for which this recipe was devised requires Python 2.2.

Ingredients you'll need:


Python 2.2. If you're using 2.1, try Zope instead, as...



NJAMD (Not Just Another Malloc Debugger) protects against all common dynamic memory bugs, without even relinking your executable. It also provides stack trace information, and eventually will include a full GUI interface. NJAMD NEEDS YOUR HELP!



CVBars are volume dependent as opposed to time dependent candlesticks; the close of the candle occurs when some volume criteria is met, not some variable timescale (1m, 5m, etc.)

This is my first attempt to code and would be grateful...



PHP-Utils is a set of classes to make it easier to build all sorts of applications, not just web-applications. One of the purposes is to make it really easy to use and equally as easy to extend with your own classes.All classes are written in PHP...



To illustrate the use case, if you have three languages enabled for content translation on your Drupal website, French, German and English, and French is the default language, when you create a new node in French, this module will automatically...



The Node Menu Parent module extends the "default menu for content" setting provided by the core menu module by allowing a specific menu item to be selected (not just a top-level menu) per content type.
Example

Imagine...



This Sourcforge project is NOT IN USE yet! It has just been created in order to explore the Sourceforge platform for a possible future use by EJS. EJS is developed and by Francisco Esquembre, University of Murcia, Spain.



With legendflex, you can:

- position the legend relative to any object in any figure, not just the parent axis of whatever is being labeled

- organize legend text and symbols in a grid with a specified number of rows and/or...



Siteman personal website CMS is small, fast, consists of few files, is easy to install and use, supports all webservers with PHP 4, does not require databases to work, and it has lots of advanced features like members accounts, forums, news...



FLOW3 is an enterprise PHP framework, an offspring from the development of a very comprehensive PHP-based open source PHP CMS(Content Managemen System) TYPO3 to make extensive use of project development paradigms that had not been brought to PHP...

User Review for When to not just use socket.close()
- required fields
     

Please enter text on the image