我正在开发一款应用WP8。我必须做广播,所以我在网上搜索,我发现这个示例代码到处都是。
public class RecvBroadcst
{
public static void Main()
{
Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
IPEndPoint iep = new IPEndPoint(IPAddress.Any, 9050);
sock.Bind(iep);
EndPoint ep = (EndPoint)iep;
Console.WriteLine("Ready to receive...");
byte[] data = new byte[1024];
int recv = sock.ReceiveFrom(data, ref ep);
string stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.WriteLine("received: {0} from: {1}",
stringData, ep.ToString());
data = new byte[1024];
recv = sock.ReceiveFrom(data, ref ep);
stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.WriteLine("received: {0} from: {1}",
stringData, ep.ToString());
sock.Close();
}
我遇到了 ReceivFrom 的问题我无法使用它,它无法识别。我搜索过,但我没有找到一些人说这个功能无法与原生WP8应用程序一起使用。所以我感到困惑和封锁,有人知道谁来解决这个问题吗?
答案 0 :(得分:0)
似乎Windows手机只能在向终端发送内容后才能收到。
因此,您尝试向端点发送内容,然后尝试var pID=$scope.ProjectId
$http({ method: 'GET', url: '/User/GetProjectsList?ProjectID='+pID}).
success(function (data, status, headers, config) {
$scope.workflow = [];
$scope.Projects = data;
}).
error(function (data, status, headers, config) {
alert('error');
})