Example #1
0
 def sendClientAddress( self, socket, address ):
     addrmsg = "client address=" + address
     print "server '%s'" % addrmsg
     buf = msgpacking.pack( addrmsg )
     socket.send( buf )
Example #2
0
                            finally:
                                fd.close()
                                
                        else:
                            filename = trans.path + os.path.sep + filename
                            fd = open( filename )
                            try:
                                buf = fd.read()
                            finally:
                                fd.close()
                        
                            
                        try:
                            bufmsg = 'got nodelist source=' + sourcestr + ' transactionID=' + str( trans.tid ) + ';\n' + buf
                            print "constructed: %s" % bufmsg
                            bufmsg = msgpacking.pack( bufmsg )

                            if not filename:
                                filename="both meta and data"

                            print "server sending data from %s" % filename
                            socket.send( bufmsg )

                        except( struct.error ), msg:
                            print "msg packing error: ", msg

                    except IOError, arg:
                        errmsg = "IOError encountered opening %s: %s" % ( filename, arg[1] )
                        print errmsg

            except( Exception ), arg: