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
Magento Australia Post eParcel Extension 1.0
Airbnb Script - Airbnb Clone 1.0.3
Hotel Restaurant Reviews and Feedback Script 1.0.3
Documenter for MySQL 1.0
ODBC Driver for xBase 1.1
ODBC Driver for FreshBooks 2.0
AnyGantt JS Gantt Charts 8.4.2
The C# Barcode Library 4.0.2.2
ConyEdit for Windows 1.1.0
wolfSSL 3.15.5
Taxi Booking App Like Uber 1.0
IP2Location Geolocation Database 2018
Food Delivery Script 1.0.3
ODBC Driver for Magento 1.3
dbForge Studio for SQL Server 5.6
Top Code
Computational Statistics: Feature Selection, Regularization, and Shrinkage 1.0
Cuckoo Search (CS) Algorithm 1.0
Cuckoo Optimization Algorithm 1.0
AllWebMenus WordPress Menu Addin 1.0.8
Visual Basic game template 1.0
Open Source Visual Basic.Net Compiler 1.0
Basic 7 7
RAM Library b.2.7
DJ Java Decompiler 3.11.11.95
Guestbook-Comment Script 2.0
Top Rated
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP GZ Blog Script 1.1
ATN Jobs Software 4.0
ATN Mall 2.0
WeBuilder 2015 13.3
PHP Digital Download Script 1.0.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: 5
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: 5



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