# Help! How to receive Struct from VC++?

**URL:** https://forum.kirupa.com/t/help-how-to-receive-struct-from-vc/75054
**Category:** Uncategorized
**Created:** [January 5, 2005, 4:54pm UTC](https://forum.kirupa.com/t/help-how-to-receive-struct-from-vc/75054 "2005-01-05T16:54:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fardreamer](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@fardreamer](https://forum.kirupa.com/u/fardreamer)
#### Post date: [January 5, 2005, 4:54pm UTC](https://forum.kirupa.com/t/help-how-to-receive-struct-from-vc/75054/1 "2005-01-05T16:54:57Z")

</div>

Hi, I’m trying to send a data structure such as

struct packet  
{  
int a;  
int b;  
int c;  
};  
(where a = 99, b = 2, c = 3 for example)

from a **Visual C++ MFC Application** (using CSocket) to a Flash movie using the following code:

First, I declared a class as follows:

class Packet {  
var a:Number;  
var b:Number;  
var c:Number;

// Constructor function  
function Packet (a:Number, b:Number, c:Number) {  
this.a = a;  
this.b = b;  
this.c = c;  
}  
}

I am able to connect to the VC++ Server succesfully and receive data using the following code:

XMLSocket.prototype.onData = function(msg: Packet)  
{  
trace(msg);  
}

However, instead of receiving the packet i send from the server, Flash MX receives the character “c” followed by 2 lines of whitespace.

Can anyone help? I don’t understand what i’m doing wrong here. Or are there alternate methods for server-client communication??
