LinuxからWindowsにデータを取得するには、C++で次のJava機能を複製する必要があります。 Winsock2は最善の方法ですか?linuxからwindows C++バイト配列
また、参考になるコードはありますか?
TIA、 B
import java.nio.ByteBuffer; public class MessageXdr { private ByteBuffer buffer; private int size; // taille max corps de message private static final int T_MAX_CORPS_MSG = 16384; public MessageXdr() { buffer = ByteBuffer.allocate(4 * T_MAX_CORPS_MSG); size =0; } public MessageXdr(byte[] array) { ByteBuffer tmpBuffer = ByteBuffer.wrap(array); buffer = tmpBuffer.asReadOnlyBuffer(); size = array.length; } public int getSize() { return size; } public int getPosition() { return buffer.position(); } public byte[] getArray() { return buffer.array(); } public void resetBuffer() { size = 0; buffer.rewind(); } public int readInt() { int retour = buffer.getInt(); return retour; } public long readUnsignedInt() { ByteBuffer tmp = ByteBuffer.allocate(8); tmp.putInt(0); tmp.putInt(buffer.getInt()); return tmp.getLong(0); } public float readFloat() { float retour = buffer.getFloat(); return retour; } public void writeInt(int v) { buffer.putInt(v); size+=4; } public void writeFloat(float v) { buffer.putFloat(v); size+=4; } }
ここで間違えてCSocketの使用について考える*の世代には、*できません。しない。うんうん、まさか。 http://tangentsoft.net/wskfaq/articles/csocket.html – JimR