bug fixes

This commit is contained in:
Alex Yatskov 2011-09-04 20:26:55 -07:00
parent af2f8894e3
commit 39783bccb4
3 changed files with 32 additions and 8 deletions

View File

@ -29,12 +29,42 @@
using namespace metacall; using namespace metacall;
//
// Local functions
//
static void serverTest1(int value) {
printf("Server function %d\n", value);
}
// //
// Program entry // Program entry
// //
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
const int port = 1234;
Server server;
if (!server.start(port)) {
perror("Cannot start server\n");
return 1;
}
Client client;
if (!client.connect("localhost", port)) {
perror("Cannot connect to server\n");
return 1;
}
server.binding()->bind(FPARAM(serverTest1));
do {
client.protocol()->invoke("serverTest1", 1234);
server.advance();
client.advance();
}
while (server.clientCount() > 0);
return 0; return 0;
} }

View File

@ -29,9 +29,6 @@
namespace metacall { namespace metacall {
namespace {
#ifdef _WIN32 #ifdef _WIN32
// //
@ -40,7 +37,7 @@ namespace {
#pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "ws2_32.lib")
struct Winsock { static struct Winsock {
Winsock() { Winsock() {
WSAData data; WSAData data;
WSAStartup(MAKEWORD(2, 2), &data); WSAStartup(MAKEWORD(2, 2), &data);
@ -54,9 +51,6 @@ struct Winsock {
#endif #endif
}
// //
// Constants // Constants
// //

View File

@ -44,7 +44,7 @@ Stream::State Stream::send(const T& packet) {
Serializer serializerSend(&buffSend_); Serializer serializerSend(&buffSend_);
serializerSend.write(header); serializerSend.write(header);
serializerSend.write(buffTemp); serializerSend.writeRaw(buffTemp.data(), buffTemp.bytes());
return STATE_READY; return STATE_READY;
} }