Receive String - DirectPlay

From: Reiter Peter (reiter_peter_at_gmxDOTat)
Date: 02/23/04


Date: Mon, 23 Feb 2004 17:04:44 +0100

hi

i need to make my application able to receive a string from a network
connection
i use for this P2P with DirectPlay

I modified the P2P example by tom miller's book
here's the OnDataReceive event:
private void OnDataReceive(object sender, ReceiveEventArgs e)

{

string temp = e.Message.ToString();

Debug.WriteLine(temp);

NetworkPacket np = new NetworkPacket();

byte[] temp1 = np.GetData();

for(int i = 0; i < temp1.Length; i++)

{

this.BeginInvoke(new AddTextCallback(AddText), new object[] {
temp1[i].ToString() });

}

Debug.WriteLine(temp1.ToString());

Debug.WriteLine(e.Message.SenderID.ToString());

Debug.WriteLine(e.Message.ReceiveData.ReadString());

// everything above this comment is from me, the rest is from the book

string newtext = string.Format

("Received message from DPlay UserId: 0x{0}",

e.Message.SenderID.ToString("x"));

this.BeginInvoke(new AddTextCallback(AddText),

new object[] { newtext });

}

Can you please help me, because i have no idea how to continue

thanx