Search Results

Search found 8 results on 1 pages for 'k80sg'.

Page 1/1 | 1 

  • Need help receiving ByteArray data

    - by k80sg
    Hi folks, I am trying to receive byte array data from a machine. It sends out 3 different types of data structure each with different number of fields which consist of mostly int and a few floats, and byte sizes, the first being 320 bytes, 420 for the second type and 560 for the third. When the sending program is launched, it fires all 3 types of data simultaneouly with an interval of 1 sec. Example: Sending order: Pack1 - 320 bytes 1 sec later Pack2 - 420 bytes 1 sec later Pack3 - 560 bytes 1 sec later Pack1 - 320 bytes ... .. . How do I check the incoming byte size before passing it to: byte[] handsize = new byte[bytesize]; as the data I receive are all out of order, for instance using the following the read all int: System.out.println("Reading data in int format:" + " " + datainput.readInt()); I get many different sets of values whenever I run my prog although with some valid field data but they are all over the place. I am not too sure how exactly should I do it but I tried the following and apparently my data fields are not receiving in correct sequence: BufferedInputStream bais = new BufferedInputStream(requestSocket.getInputStream()); DataInputStream datainput = new DataInputStream(bais); byte[] handsize = new byte[560]; datainput.readFully(handsize); int n = 0; int intByte[] = new int[140]; for (int i = 0; i < 140 ; i++) { System.out.println("Reading data in int format:" + " " + datainput.readInt()); intByte[n] = datainput.readInt(); n = n + 1; System.out.println("The value in array is:" + intByte[0]); System.out.println("The value in array is:" + intByte[1]); System.out.println("The value in array is:" + intByte[2]); System.out.println("The value in array is:" + intByte[3]); Also from the above code, the order of the values printed out with System.out.println("Reading data in int format:" + " " + datainput.readInt()); and System.out.println("The value in array is:" + intByte[0]); System.out.println("The value in array is:" + intByte[1]); are different. Any help will be appreciated. Thanks

    Read the article

  • winsock receiving incoming data slower than expected.

    - by k80sg
    Hi folks, I have a sender machine which sends bytearray data to my prog at an interval of about 5 miliseconds/per msg, about 6 - 7 bytearray messages per seconds that is. The problem is that the winsock in my program doesn't seem to receive these bytearray fast enough. For every 10 messages sent over, I am only able to receive about 6 to 7. Any advices? Thanks.

    Read the article

  • How to get size of bytes?

    - by k80sg
    How do I obtain the number of bytes before allocating the byte size of the array 'handsize' as shown below as the incoming ByteArray data are sent in 3 different sizes. Thanks. BufferedInputStream bais = new BufferedInputStream(requestSocket.getInputStream()); DataInputStream datainput = new DataInputStream(bais); //need to read the number of bytes here before proceeding. byte[] handsize = new byte[bytesize]; datainput.readFully(handsize);

    Read the article

  • How do I recieve byteArray sent from a Server and read 4 single bytes at a time.

    - by k80sg
    I need to receive 320 bytes of data from a server which consist of 80 4 byte int fields. How do I receive them in bytes of 4 and display their respective int values? Thanks. Not sure if this is right for the receiving part: //for reading the data from the socket BufferedInputStream bufferinput=new BufferedInputStream(NewSocket.getInputStream()); DataInputStream datainput=new DataInputStream(bufferinput); byte[] handsize=new byte[32]; // The control will halt at the below statement till all the 32 bytes are not read from the socket. datainput.readFully(handsize);

    Read the article

  • How do I recieve byteArray send from Server and read 4 single bytes at a time.

    - by k80sg
    I need to receive 320 bytes of data from a server which consist of 80 4 bytes int fields. How do I receive them in bytes of 4 and display their respective int values? Thanks. Not sure if this is right for the receiving part: //for reading the data from the socket BufferedInputStream bufferinput=new BufferedInputStream(NewSocket.getInputStream()); DataInputStream datainput=new DataInputStream(bufferinput); byte[] handsize=new byte[32]; // The control will halt at the below statement till all the 32 bytes are not read from the socket. datainput.readFully(handsize);

    Read the article

  • VB.Net Sending byte array from client to server

    - by k80sg
    Hi guys, I am new to VB.net and struggling to get out of VB6's way of sending data, I am doing this to send a byte array from my client to server, please advice if this is the right way, thanks: The sending portion: Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim arrNo(3) As Integer arrNo(0) = 1400 arrNo(1) = 1000 arrNo(2) = 1200 arrNo(3) = 1350 Dim i As Integer For i = 0 To arrNo.Length - 1 Dim outStream() As Byte = BitConverter.GetBytes(arrNo(i)) Debug.Print(arrNo(i)) serverStream.Write(outStream, 0, outStream.Length) serverStream.Flush() Next End Sub

    Read the article

  • VB6 Require some help with looping

    - by k80sg
    Hi, I am trying to convert a source from C++ to vb6: C++: static double mdArray[3][3]; static double mdArray2[3][3]; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) { double sum = 0; for(k = 0; k < 3; k++) sum = sum + mdArray[k][i] * mdArray[k][k]; mdArray2[i][j] = sum } VB6: dim mdArray(0 to 2, 0 to 2) as integer dim mdArray2(0 to 2, 0 to 2) as integer for i = 0 to 2 for j = 0 to 2 dim a as double sum = 0 for k = 0 to 2 sum = sum + mdArray(k,i) * mdArray(k,j) mdArray2(i,j) = sum Next Next Next Will the vb6 version yield the same result as the C++ version? Thanks.

    Read the article

1