java - Android and C# tcp connection sockets -


My question is not about creating a connection. My question is about reading section in the C # code Java Android code Sending 3 parameters from DataOutputStream The C # code gets them all, but in different sockets. I mean if I have an array byte, then it will be in 2 different messages. Let's look at the code and get it clearly. Java code:

  Private data output stream out; InetAddress serverAddr = InetAddress.getByName ("192.168.43.145"); Socket = new socket (server edit, port); Out = New Data Optical Stream (socket.getOutputStream ()); // Header Out.LiteBite (IDMessage); // Example: IDMessageis 1 / The data is out WriteDouble (LongX); // Example: Longx is 35.4 out. Written repeat (lying); // Example: Layer 31.5 out. Flush (); The array byte is obtained by using the data   

and c # code read:

  // data (byte []) (memory = new memorystream (data) ) {(R = new binary reader (memory)) {IDMessage = r.ReadInt32 (); Lang = r Read double (); Lat = r.ReadDouble (); }}  

Again: The problem is that Massage is obtained in 2 different byte array. I mean that 1 array will be 1,0,0,0, ..... and the other array in different masses 35.4,31.5,0,0,0,0,0, 0, ......

Why is any idea of ​​any person being born? Thank you. :)

Edit: By the way in the message, I need to send only one parameter in the first massage, so it works very well by sending and reading it, it sends 1 parameter alone in two massages And the other socket has two pairs Edit: Proxy code:

  int k = 0; Byte [] byte retached = new byte [1024]; // Start the listing for the specified port listener. Android Start (); // Server is now running and waiting for client connection. Sender = Android for Audiences Acceptance (); // Client accepted (IsListener) {try {k = sender.Receive (byteRecived); // server message is resistved This line is getting 2 other massages. Header h = new header (byte attested); Message = MessageFactory.getMessage (h); If (Message is RequestID) {CounterObser ++; SendIDMessage (sender, counterObserver); } Message.DeSerialize (byte attested); Message.Execute (); } {}  


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -