Message153361
| Author |
srikadur |
| Recipients |
srikadur |
| Date |
2012年02月14日.19:12:26 |
| SpamBayes Score |
0.004103117 |
| Marked as misclassified |
No |
| Message-id |
<1329246747.9.0.165584216371.issue14016@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Here is my code.
Func1():
.
.
CliSock, addr = ServSocket.accept()
print 'DataPortServ:Connected by', addr
data.DataSendSock = CliSock
for cnt in range(data.ThreadCnt):
SessionId = startSessionId + SessionIdCnt* cnt
thread.start_new_thread(ThreadHandleDataPort,(("Thead"+str(cnt)),data,EventCnt[cnt],EventCnt[cnt+1],UECntPerThread,ip,SessionId))
time.sleep(0.005)
ThreadHandleDataPort(args):
#here i use socket.sendall
while True:
if ( 3 != data.bRunFlag):
if (len(data.AddedEvents) != 0) | (len(data.AddedReasons) != 0):
#time.sleep(5)
for EventCnt in range(StartEvent,StopEvent):
.
.
.
data.DataSendSock.sendall(SendEvent)
.
.
My application is a server and it accepts connection from the client on a port and start sending some messages to the client. While sending messages i use multiple threads for the same socket based on required traffic.
I do not modify any global variables but i read only global variables.But at high Loads my messages are being corrupted, here is the snippet of the corruption
actual message should have been
ABS1,1328577019.57,181138955,
instead im getting
ABS1,1329218634.91,181ABS1
so here is my Q:
Do i need to lock the socket before sending inside the threads or Python modules will take care of it? Please suggest. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年02月14日 19:12:28 | srikadur | set | recipients:
+ srikadur |
| 2012年02月14日 19:12:27 | srikadur | set | messageid: <1329246747.9.0.165584216371.issue14016@psf.upfronthosting.co.za> |
| 2012年02月14日 19:12:26 | srikadur | link | issue14016 messages |
| 2012年02月14日 19:12:26 | srikadur | create |
|