Address:
Http://www.cnblogs.com/sevenyuan/archive/2012/06/20/2556494.html
A new socket server can be opened to listen on port 843, specifically for processing AS3 sent sandboxed requests. After processing, then close the connection.
An extra question.
AS3 reads the data sent by the C++socket, prompting for a file end error.
In case of Error:error #2030: Encountered a file tail error, please use: str=socket.readutfbytes (socket.bytesavailable);
Some of this errors was thrown if the proper listener is not added.
is listening for and asyncError
ioError
events from your netconnection?
If not, just give it a try.
Amount, finally understand, not the problem of the server, is not the problem of line break, is the TCP/IP communication protocol problem, seemingly Java direct read does not appear this problem, the above Java server each time the client's data is correct, AS3 has this problem, Is that every time you read the time without reading the whole byte stream, to verify the integrity of the packet, when the packet length >= the length of the server packet, then read the words will not appear above the problem.
For example, put if (_socket.bytesavailable >= 4)
{
cmd = _socket.readunsignedint ();
Ondeal (CMD);
}
Change to if (_socket.bytesavailable >= 20)
{
cmd = _socket.readunsignedint ();
Ondeal (CMD);
}
The client will read the correct data
C + + socket resolution for sandboxed communication with Flex AS3