How to Send/Receive Intensive Data?

G

Guest

Hello Developpers

I am using Visual C++ .NET Standard Edition 2003 on Windows 2000 Professional. I would like to send intensive collection of data, which includes int, float, names, through ethernet using TCP/IP from Server to Client or vice verse. During this communication the number of data are intensive. During the communication, the format of data sent and received is fix. So to seperate the data into necessary int, float, String variables is required. I was sending ASCII characters by casting all data types to string and concatenating them. I read that binary data sending could solve this problem. But I do not know what is binary data sending

Do you have any idea about sending and receiving intensive data techniques without loss of data, speed problem, etc

Thank you very much in advance for your kind considerations
 
P

priyamjm

Format your data in to structure and send that structure over. Other side
when you get data make sure that you have get size of structure and now you
can cast that data to structure again and use that in to your application.

Issue. All data in this struct must me static members.

Ex:

struct stMyData
{
int intTemp;
char chName[100];
}

Client:
====
stMyData a;
send(..., (char *)a, sizeof(stMyData));


Server
====

recv(.., data, );
stMyData *p;
p = (stMyData *)data;

//Your data now is in p.

Have fun.

Alper Akcayoz said:
Hello Developpers,

I am using Visual C++ .NET Standard Edition 2003 on Windows 2000
Professional. I would like to send intensive collection of data, which
includes int, float, names, through ethernet using TCP/IP from Server to
Client or vice verse. During this communication the number of data are
intensive. During the communication, the format of data sent and received is
fix. So to seperate the data into necessary int, float, String variables is
required. I was sending ASCII characters by casting all data types to string
and concatenating them. I read that binary data sending could solve this
problem. But I do not know what is binary data sending?
Do you have any idea about sending and receiving intensive data techniques
without loss of data, speed problem, etc.
 
G

Guest

Can you do the similar in VB.net?

i.e. cast a structure into byte array and read a byte array and cast it back into that structure?

priyamjm said:
Format your data in to structure and send that structure over. Other side
when you get data make sure that you have get size of structure and now you
can cast that data to structure again and use that in to your application.

Issue. All data in this struct must me static members.

Ex:

struct stMyData
{
int intTemp;
char chName[100];
}

Client:
====
stMyData a;
send(..., (char *)a, sizeof(stMyData));


Server
====

recv(.., data, );
stMyData *p;
p = (stMyData *)data;

//Your data now is in p.

Have fun.

Alper Akcayoz said:
Hello Developpers,

I am using Visual C++ .NET Standard Edition 2003 on Windows 2000
Professional. I would like to send intensive collection of data, which
includes int, float, names, through ethernet using TCP/IP from Server to
Client or vice verse. During this communication the number of data are
intensive. During the communication, the format of data sent and received is
fix. So to seperate the data into necessary int, float, String variables is
required. I was sending ASCII characters by casting all data types to string
and concatenating them. I read that binary data sending could solve this
problem. But I do not know what is binary data sending?
Do you have any idea about sending and receiving intensive data techniques
without loss of data, speed problem, etc.
Thank you very much in advance for your kind considerations.
 
G

Guest

Hi all,

Is it possible to cast an object or a structure into byte array without the use of the serialize class? (Or please convert the example below to VB.net)

Great thanks in advance.

e.g.)

struct _STUDENT{
__int32 id;
char name[36];
}STUDENT;

(assuming student is packed in a way that it has the size of 40 bytes)

void main(){
STUDENT student;
byte result[40];
student.id = 10;
student.name = "Ben Smith"
result = (byte*) &student;
return;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top