I just found some bsd socket codes for Linux like this ….(<sys/socket.h>…),
but I can’t use them in win32,.
someone told me that I can use (#include <winsock2.h> #pragma comment(lib, “ws2_32.lib”) ) instead in win32,
if I use <winsock2.h> and so on , can I transplant these code to iOS and Android???
There are some cross-platform socket libraries around. I’m not sure if I would use one. I sort of subscribe to doing the platform native way when you get this low-level, but check out: http://sourceforge.net/projects/netlinksockets/
Compiling and creating a Socket Communication Layer for a game is one of the hardest job. With a few experience in network communication for Game/Application I have some suggestion for you. With some following steps:
1 . Write a basic connection socket. (I am using Google Protocol Buffer). Compile it for iOS, Android, WP successful.
2. Write a message handler for that connection, preprocess, save data to a data-store in phone, send message back, etc.
3. Write a NetworkManager Layer which will work with some Message Handler, Read data form Data-Store, etc.
4. Improve them for your game.