[nanomsg] 答复: [nanomsg] Re: Different behaviour between Linux and Windows

  • From: "^^" <2mailme@xxxxxxx>
  • To: <nanomsg@xxxxxxxxxxxxx>
  • Date: Tue, 24 Apr 2018 11:58:16 +0800

Thank you Sir,

 

Yes, I am using TCP, both of server is on Intel x86/x64 series CPU.

 

Actually I suspect the bug is came from my code or the library I built, 

I have applied nanomsg to various of my project, everything works great.

 

But this time it makes me very tired, so I just choose the fastest way: find 
help.

 

I will rebuild the Windows library and test it again, if the problem can’t be 
solved myself, I will 

 

Send the main code piece for investigation.

 

 

Thank you very much!

 

 

Xun

 

 

 

发件人: nanomsg-bounce@xxxxxxxxxxxxx [mailto:nanomsg-bounce@xxxxxxxxxxxxx] 代表 ;
Garrett D'Amore
发送时间: 2018年4月24日 11:47
收件人: nanomsg@xxxxxxxxxxxxx
主题: [nanomsg] Re: Different behaviour between Linux and Windows

 

Assuming you’re using TCP, the message format is identical between Windows and 
Linux.  (If you’re using IPC, then that’s not true, as Windows uses Named Pipes 
which are quite different from UNIX domain sockets used on Linux.)

 

Now, there are lots of different things under the hood — scheduling, etc. which 
can cause differences in behavior, usually as a result of faulty code (in the 
library or in the application.)

 

One thing that you should be aware of — are you using x86 CPUs in both cases?  
If the processor architecture is different you may find that there endianness 
considerations that you’ve not handled in your application correctly.  (For 
example if you have an ARM CPU running in big-endian mode, and are just writing 
integers without handling byte order conversions in your application payload.)

 

I’d have to see some code to debug this further.  It’s always best when 
submitting code to try to pare it down to the minimal amount of C code to 
demonstrate the problem, if you can.

 

Thanks.

 

 - Garrett

 

On Mon, Apr 23, 2018 at 7:42 PM ^^ <2mailme@xxxxxxx <mailto:2mailme@xxxxxxx> > 
wrote:

Dear Sir,

 

Sorry for disturbing you.

 

I have a problem which is confusing me.

 

I develop a program which has a producer, 2 workers, and a collector.

 

Producer read file and send raw binary data frame by frame to workers, workers 
process(just add header and rearrange line of raw data) and send it to 
collector.

 

1)       The pattern I used is PUSH – PULL:

producer works as server, push data;

workers work as client, pull data, after processing then push data to collector;

Collector works as server, pull data from workers.

 

First time, I deployed producer, workers and collector to a Linux server, I 
used different port to separate 2 workers, everything works good.

For testing purpose, I moved a worker to a Windows server,  then headache thing 
happens, the data processed by worker on windows is corrupted.

Then I closed the worker on Linux, only let the worker on Windows alive, all 
data received by collector is corrupt.

 

I tested multiple time, on Linux, no matter how many workers there are, the 
data outputted by collector is correct, but if data transferred to Windows then 
return, only first few bytes are correct, others are corrputed.

 

All nn_send and nn_recv use NN_MSG flag, and the data size is about 700KB. 
Linux and Windows worker’s source code is exactly same.

The nanomsg version both on Windows and Linux is 1.1.2

 

 

I am wondering is there differences between Linux and Windows message format or 
messaging mechanism?

Or just I missed something important.

If necessary, I will send you my code.

 

Hope to have your help.

 

Thank you.

 

Other related posts: