Pastes:104471  Views:2146306 

Languages:

   ASP
   C#
   C++
   HTML
   Java
   PHP
   VB.NET
   Visual Basic 6

more languages available...


Looking to freelance?

( bids)

( bids)

( bids)

( bids)

( bids)

Hire Freelancers & Find Freelance Jobs Online - Freelancer.com

Ready to launch?

Hire Work

The #1 Resource for Small Business & Entrepreneurs

Hire freelancers for a fraction of the cost!

  • Post your project within seconds

  • Compare prices & select bidders

  • Pay only once satisfied

Looking for work?

Become a freelancer and earn money!

  • Browse jobs matching your skills

  • Apply for work

  • Get hired and earn money

or
Sign up with your email address
Looking to hire?

1. Describe your project

2. Set budget

  1. Budget type
  2. Hours of work required
  3. hours per Week
  4. previous step

3. Log in/Sign up

  1. I am a
  2. previous step
( bids)

Source: GetAFreelancer.com


Fast 3D Prototyping

 

 

 

 

 

 

Here's the requested code from the pastebin:

Wrap Lines   Use Line Numbers
#
# Written by astigmatik
# This is for Jython2.2 RC2 and to show a possible bug when
#  sending to a socket that has been closed/disconnected.
#
 
import socket, threading
 
class SimpleServer(threading.Thread):
 
  def __init__(self):
     print "Server opened"
 
  def run(self):
     serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     serversocket.bind(('localhost', 6667))
     serversocket.listen(1)
     print "Server listening"
     while 1:
        (clientsocket, address) = serversocket.accept()
        print "Server has accepted client"
        break
     clientsocket.close()
     serversocket.close()
     print "Server has closed all sockets"
 
class SimpleClient:
 
  def __init__(self):
     print "Client opened"
 
  def connect(self):
     print "Client connecting"
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.connect(('localhost', 6667))
     self.sockname = s
     print 'Client will send data to socket after 5 seconds'
     t = threading.Timer(5, self.sockwrite)
     t.start()
 
  def sockwrite(self):
     print 'Client trying to send data'
     self.sendtry(self.sockname, 1)
     self.sendtry(self.sockname, 2)
     print "Done"
 
  def sendtry(self, s, n):
     print "Client attempting to send data. Try no. %s" % n
     try:
        s.send('Hello')
     except socket.error:
        print "Socket error at try no. %s" % n
        s.close()
        print "Client closed from try no. %s" % n
 
def openclient():
  c = SimpleClient()
  c.connect()
 
def main():
  t = threading.Timer(10, openclient)
  t.start()
  server = SimpleServer()
  server.run()
 
if __name__ == '__main__':
  main()
Syntax Highlighting:  



Copyright 2007 - NoMorePasting.com