Network debugging
This commit is contained in:
@@ -23,8 +23,15 @@ namespace PolyChat.Models
|
|||||||
InitEventHandlers(this, connection, uiController);
|
InitEventHandlers(this, connection, uiController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when socket accepts client
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="connection"></param>
|
||||||
|
/// <param name="ip"></param>
|
||||||
|
/// <param name="uiController"></param>
|
||||||
public Client(SocketIOSocket connection, String ip, MainPage uiController)
|
public Client(SocketIOSocket connection, String ip, MainPage uiController)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine("New Client Saved!!!!(Clinent[34])");
|
||||||
this.ipSelf = ip;
|
this.ipSelf = ip;
|
||||||
this.connection_server = connection;
|
this.connection_server = connection;
|
||||||
InitEventHandlers(this, connection, uiController);
|
InitEventHandlers(this, connection, uiController);
|
||||||
@@ -87,7 +94,9 @@ namespace PolyChat.Models
|
|||||||
{
|
{
|
||||||
connection.On(SendCode.Message.ToString(), (Data) =>
|
connection.On(SendCode.Message.ToString(), (Data) =>
|
||||||
{
|
{
|
||||||
Message msg = new Message(Data[0]);
|
//Message msg = new Message(Data[0]);
|
||||||
|
Debug.WriteLine("Normal Message Recieved!!!!");
|
||||||
|
Message msg = JsonNet.Deserialize<Message>(Data[0].ToString());
|
||||||
uiController.OnIncomingMessage(msg);
|
uiController.OnIncomingMessage(msg);
|
||||||
|
|
||||||
//TODO: send message to GUI
|
//TODO: send message to GUI
|
||||||
@@ -101,6 +110,7 @@ namespace PolyChat.Models
|
|||||||
|
|
||||||
connection.On(SocketIOEvent.CONNECTION, () =>
|
connection.On(SocketIOEvent.CONNECTION, () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
client.connected = true;
|
client.connected = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -114,7 +124,9 @@ namespace PolyChat.Models
|
|||||||
{
|
{
|
||||||
connection.On(SendCode.Message.ToString(), (Data) =>
|
connection.On(SendCode.Message.ToString(), (Data) =>
|
||||||
{
|
{
|
||||||
Message msg = new Message(Data[0]);
|
Debug.WriteLine("Normal Message Recieved!!!!");
|
||||||
|
Message msg = JsonNet.Deserialize<Message>(Data[0].ToString());
|
||||||
|
//Message msg = new Message(Data[0]);
|
||||||
uiController.OnIncomingMessage(msg);
|
uiController.OnIncomingMessage(msg);
|
||||||
//TODO: send message to GUI
|
//TODO: send message to GUI
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Json.Net;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PolyChat.Models
|
namespace PolyChat.Models
|
||||||
@@ -35,7 +36,8 @@ namespace PolyChat.Models
|
|||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public Message(JToken data)
|
public Message(JToken data)
|
||||||
{
|
{
|
||||||
Message m = (Message) data[0].ToObject<Message>();
|
|
||||||
|
Message m = (Message) data.ToObject<Message>();
|
||||||
Sender = m.Sender;
|
Sender = m.Sender;
|
||||||
Timestamp = m.Timestamp;
|
Timestamp = m.Timestamp;
|
||||||
StringTimeStamp = Timestamp.ToString();
|
StringTimeStamp = Timestamp.ToString();
|
||||||
@@ -43,6 +45,11 @@ namespace PolyChat.Models
|
|||||||
Ip = m.Ip;
|
Ip = m.Ip;
|
||||||
Foreign = m.Foreign;
|
Foreign = m.Foreign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Message()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override
|
override
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using SocketIOSharp.Server;
|
|||||||
using SocketIOSharp.Server.Client;
|
using SocketIOSharp.Server.Client;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Json.Net;
|
||||||
|
|
||||||
namespace PolyChat.Models
|
namespace PolyChat.Models
|
||||||
{
|
{
|
||||||
@@ -53,9 +54,9 @@ namespace PolyChat.Models
|
|||||||
{
|
{
|
||||||
socket.On(SendCode.Initial.ToString(), (JToken[] Data) =>
|
socket.On(SendCode.Initial.ToString(), (JToken[] Data) =>
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Client connected!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
Debug.WriteLine("Client connected and Initial Message Recieved!!!!!!!!!!!!!!!!!");
|
||||||
Message m = new Message(Data[0]);
|
Message msg = JsonNet.Deserialize<Message>(Data[0].ToString());
|
||||||
clients.Add(new Client(socket,m.Ip, uiController));
|
clients.Add(new Client(socket,msg.Ip, uiController));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ namespace PolyChat.Models
|
|||||||
/// <param name="msg"> to send </param>
|
/// <param name="msg"> to send </param>
|
||||||
public void sendMessage(String ip, String msg)
|
public void sendMessage(String ip, String msg)
|
||||||
{
|
{
|
||||||
this.getClient(ip).sendMessage(SendCode.Initial, msg);
|
this.getClient(ip).sendMessage(SendCode.Message, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -4,7 +4,12 @@
|
|||||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||||
IgnorableNamespaces="uap mp">
|
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
|
||||||
|
xmlns:uap6="http://schemas.microsoft.com/appx/manifest/uap/windows10/6"
|
||||||
|
xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10"
|
||||||
|
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
|
||||||
|
xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2"
|
||||||
|
IgnorableNamespaces="uap mp uap3 uap6 iot uap4 uap2">
|
||||||
|
|
||||||
<Identity
|
<Identity
|
||||||
Name="ee2ef4f2-e61b-497a-8f0e-9fa7c90234b1"
|
Name="ee2ef4f2-e61b-497a-8f0e-9fa7c90234b1"
|
||||||
@@ -45,5 +50,41 @@
|
|||||||
|
|
||||||
<Capabilities>
|
<Capabilities>
|
||||||
<Capability Name="internetClient" />
|
<Capability Name="internetClient" />
|
||||||
|
<Capability Name="internetClientServer"/>
|
||||||
|
<Capability Name="allJoyn"/>
|
||||||
|
<uap:Capability Name="appointments"/>
|
||||||
|
<uap3:Capability Name="backgroundMediaPlayback"/>
|
||||||
|
<uap:Capability Name="blockedChatMessages"/>
|
||||||
|
<uap:Capability Name="chat"/>
|
||||||
|
<Capability Name="codeGeneration"/>
|
||||||
|
<uap:Capability Name="contacts"/>
|
||||||
|
<uap:Capability Name="enterpriseAuthentication"/>
|
||||||
|
<uap6:Capability Name="graphicsCapture"/>
|
||||||
|
<iot:Capability Name="lowLevelDevices"/>
|
||||||
|
<uap:Capability Name="musicLibrary"/>
|
||||||
|
<uap:Capability Name="objects3D"/>
|
||||||
|
<uap4:Capability Name="offlineMapsManagement"/>
|
||||||
|
<uap:Capability Name="phoneCall"/>
|
||||||
|
<uap2:Capability Name="phoneCallHistoryPublic"/>
|
||||||
|
<uap:Capability Name="picturesLibrary"/>
|
||||||
|
<Capability Name="privateNetworkClientServer"/>
|
||||||
|
<uap3:Capability Name="remoteSystem"/>
|
||||||
|
<uap:Capability Name="removableStorage"/>
|
||||||
|
<uap:Capability Name="sharedUserCertificates"/>
|
||||||
|
<uap2:Capability Name="spatialPerception"/>
|
||||||
|
<iot:Capability Name="systemManagement"/>
|
||||||
|
<uap:Capability Name="userAccountInformation"/>
|
||||||
|
<uap3:Capability Name="userNotificationListener"/>
|
||||||
|
<uap:Capability Name="videosLibrary"/>
|
||||||
|
<uap:Capability Name="voipCall"/>
|
||||||
|
<uap4:Capability Name="userDataTasks"/>
|
||||||
|
<DeviceCapability Name="bluetooth"/>
|
||||||
|
<DeviceCapability Name="gazeInput"/>
|
||||||
|
<DeviceCapability Name="lowLevel"/>
|
||||||
|
<DeviceCapability Name="microphone"/>
|
||||||
|
<DeviceCapability Name="location"/>
|
||||||
|
<DeviceCapability Name="pointOfService"/>
|
||||||
|
<DeviceCapability Name="proximity"/>
|
||||||
|
<DeviceCapability Name="webcam"/>
|
||||||
</Capabilities>
|
</Capabilities>
|
||||||
</Package>
|
</Package>
|
||||||
Reference in New Issue
Block a user