Hello,
I wrote a small c# app to initialize insim through the udp port.
I'm getting an error saying:
insim: port 30000
insim - udp : unnamed (port 30000)
[RED text] InSim: Packet received before ISI packet
obviously, it did not initialise insim properly.
I've followed the C# tutorial as reference on how to marshal all the data types into a byte packet of size 44
here is my code. Note that I was too lazy to figure out how to marshal the admin and server name, but i suspect that these data values do not matter. so I just set all the bytes to 0
note: please don't laugh at my code, this is more or less my first c# app.
public byte [] initPacket()
{
//create an array for the Insim Initialisation packet
byte[] data = new byte[size];
//size of packet
data[0] = size;
//packet type
data[1] = 0x01;
//ReqI
data[2] = ReqI;
//zero value packet
data[3] = 0;
//UDP Port
data[4] = BitConverter.GetBytes(UDPPort)[0];
data[5] = BitConverter.GetBytes(UDPPort)[1];
//flags
data[6] = BitConverter.GetBytes(Flags)[0];
data[7] = BitConverter.GetBytes(Flags)[1];
//Sp0 - Set value to 0
data[8] = 0;
//prefix
data[9] = (byte)Prefix;
//interval
data[10] = BitConverter.GetBytes(Interval)[0];
data[11] = BitConverter.GetBytes(Interval)[1];
for(int i = 12; i<43; i++){
data[i] = 0;
}
data[43] = 0;
return data;
}
}
here is the code that creates the instance of my struct.
IS_ISI isInit = new IS_ISI();
isInit.type = (byte)PacketType.ISP_ISI;
isInit.ReqI = 1;
isInit.Zero = 0;
isInit.UDPPort = 30000; //use port 0
isInit.Flags = 0;
isInit.Sp0 = 0;
isInit.Prefix = '!';
isInit.Interval = 100; //100msec interval -> send data through UDP port instead of TCP
and this is the command to send the packet
sendSocket.SendTo(isInit.initPacket(),sendEndpoint);
I wrote a small c# app to initialize insim through the udp port.
I'm getting an error saying:
insim: port 30000
insim - udp : unnamed (port 30000)
[RED text] InSim: Packet received before ISI packet
obviously, it did not initialise insim properly.
I've followed the C# tutorial as reference on how to marshal all the data types into a byte packet of size 44
here is my code. Note that I was too lazy to figure out how to marshal the admin and server name, but i suspect that these data values do not matter. so I just set all the bytes to 0
note: please don't laugh at my code, this is more or less my first c# app.
public byte [] initPacket()
{
//create an array for the Insim Initialisation packet
byte[] data = new byte[size];
//size of packet
data[0] = size;
//packet type
data[1] = 0x01;
//ReqI
data[2] = ReqI;
//zero value packet
data[3] = 0;
//UDP Port
data[4] = BitConverter.GetBytes(UDPPort)[0];
data[5] = BitConverter.GetBytes(UDPPort)[1];
//flags
data[6] = BitConverter.GetBytes(Flags)[0];
data[7] = BitConverter.GetBytes(Flags)[1];
//Sp0 - Set value to 0
data[8] = 0;
//prefix
data[9] = (byte)Prefix;
//interval
data[10] = BitConverter.GetBytes(Interval)[0];
data[11] = BitConverter.GetBytes(Interval)[1];
for(int i = 12; i<43; i++){
data[i] = 0;
}
data[43] = 0;
return data;
}
}
here is the code that creates the instance of my struct.
IS_ISI isInit = new IS_ISI();
isInit.type = (byte)PacketType.ISP_ISI;
isInit.ReqI = 1;
isInit.Zero = 0;
isInit.UDPPort = 30000; //use port 0
isInit.Flags = 0;
isInit.Sp0 = 0;
isInit.Prefix = '!';
isInit.Interval = 100; //100msec interval -> send data through UDP port instead of TCP
and this is the command to send the packet
sendSocket.SendTo(isInit.initPacket(),sendEndpoint);