Sockets - writeObject() problem

I want adobe sockets to send “customized” class object to a server socket(WinSock2). I used socket.writeObject(myClassObj).

Actually My flash application and windows application works for string buffer but not for object.

//Flash
var buffer:String = "God Bless Us";
socket.writeUTFBytes(buffer);

// WinSock2
iResult = recv(ClientSock, recvbuf, recvbuflen, 0);

Is there anything I must do before writeObject() is used.? Please advice.