Home › Forums › Support › client-server to exchange files (like in p2p?) › Reply To: client-server to exchange files (like in p2p?)
July 18, 2013 at 18:46
#969
Anonymous
Inactive
I’m doing trivial connection tests on Networkcomm libary.
I just done into an Activity:
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
//
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button> (Resource.Id.myButton);
button.Click += delegate {
button.Text = string.Format ("{0} clicks!", count++);
try
{
UDPConnection.SendObject("ChatMessage",
"This is the broadcast test message!",
new IPEndPoint(IPAddress.Broadcast, 10000));
}
catch (System.NotSupportedException err1) {
Console.WriteLine(err1.Message);
}
catch (CommsException err2) {
Console.WriteLine(err2.Message);
}
catch (Exception err3) {
Console.WriteLine(err3.Message);
}
};
NetworkComms.AppendGlobalIncomingPacketHandler<string>("ChatMessage",
(packetHeader, connection, incomingString) =>
{
Console.WriteLine("\n ... Incoming message from " +
connection.ToString() + " saying '" +
incomingString + "'.");
});
//Start listening for incoming UDP data
UDPConnection.StartListening(true);
}
}
On the button click event I send a bradcast message. I’ve installed the same App in two devices who are on my net (tested with your chat samples and are working). Just in the first I click on button expecting in the second app which is listening something happen, but in the AppendGlobalIncomingPacketHandler the debugger never pass through ….. Where Do I’m wrong ?
Thanks,
Max