Windows Phone 7 通过 wifi 接收 UDP 数据包(广播或单播)

2024-01-01

我已经看了好几天有关 Windows Phone 7 的各个论坛,但没有一个给我明确的答案。 到目前为止,我还无法接收从通过 wifi 连接到 Windows Phone 7 设备(在模拟器上运行)的计算机发送的 UDP 数据包(既不是广播也不是单播)。

显然应该支持 UDP 单播,并且下面的代码运行正确,但是没有从手机收到 UDP 数据包。 我希望有人可以纠正下面的代码。

请注意,以下代码遵循其他论坛上迄今为止给出的所有建议,即:

  1. 首先将数据包发送到预定目的地,然后监听回复
  2. 不要使用广播,而是使用 UDP 单播(我可以测试这两个设置 isBroadcast 变量)
  3. 使用 SilverLight 允许的端口 4502

主页.xaml

   <phone:PhoneApplicationPage 
      x:Class="UDPClient.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
      xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
      FontFamily="{StaticResource PhoneFontFamilyNormal}"
      FontSize="{StaticResource PhoneFontSizeNormal}"
      Foreground="{StaticResource PhoneForegroundBrush}"
      SupportedOrientations="Portrait" Orientation="Portrait"
      shell:SystemTray.IsVisible="True">

      <!--LayoutRoot is the root grid where all page content is placed-->
      <Grid x:Name="LayoutRoot" Background="Transparent">
          <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
          </Grid.RowDefinitions>

      <!--TitlePanel contains the name of the application and page title-->
          <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
          <TextBlock x:Name="ApplicationTitle" Text="UDP Socket Application" Style="{StaticResource PhoneTextNormalStyle}"/>
          <TextBlock x:Name="PageTitle" Text="Client" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
          </StackPanel>


          <!--ContentPanel - place additional content here-->
          <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,-8,12,8">
          <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/>
              <!-- Fit to content -->
              <ColumnDefinition Width="Auto"/>
              <!-- Fit to content -->
              <ColumnDefinition Width="Auto"/>
              <!-- Fit to content -->
              <ColumnDefinition Width="*"/>
              <!-- Take up remaining space -->
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <!-- Fit to content -->
              <RowDefinition Height="Auto"/>
              <!-- Fit to content -->
              <RowDefinition Height="Auto"/>
              <!-- Fit to content -->
              <RowDefinition Height="*"/>
              <!-- Take up remaining space -->
          </Grid.RowDefinitions>

          <!-- Grid Row 0: Remote Host Input Field >-->
          <TextBlock Grid.Row="0" Grid.Column="0" Text="Host Name:"  
                VerticalAlignment="Center" HorizontalAlignment="Center" 
                FontSize="{StaticResource PhoneFontSizeNormal}" />
          <TextBox x:Name="txtRemoteHost" Grid.Row="0" Grid.Column="1"  Height="70" Width="200" 
              VerticalAlignment="Top" HorizontalAlignment="Left" 
              FontSize="{StaticResource PhoneFontSizeNormal}" Text="192.168.1.3" />

          <!-- Grid Row 1: Echo >-->
          <!-- TextBlock for Echo command label-->
          <TextBlock Grid.Row="1" Grid.Column="0" Text="Text To Echo:" 
                VerticalAlignment="Center" HorizontalAlignment="Center" 
                FontSize="{StaticResource PhoneFontSizeNormal}" />

          <!-- TextBox for Echo command text input-->
          <TextBox x:Name="txtInput" Grid.Row="1" Grid.Column="1" Height="70" Width="200"  
              VerticalAlignment="Top" HorizontalAlignment="Left" 
              FontSize="{StaticResource PhoneFontSizeNormal}" Text="test..." />

          <!-- Button to the right of the input textbox for the Echo command >-->
          <Button x:Name="btnEcho" Grid.Row="1" Grid.Column="2" Height="70"  Width="120" 
              Content="Echo" 
              FontSize="{StaticResource PhoneFontSizeNormal}" Click="btnEcho_Click"/>

          <!-- Grid Row 2: Quote of the Day-->
          <!-- Button for the Quote command >-->
          <Button x:Name="btnGetQuote" Grid.Row="2" Grid.ColumnSpan="4" Height="70" 
              Content="Get Quote of the Day" 
              FontSize="{StaticResource PhoneFontSizeNormal}" Click="btnGetQuote_Click"/>
          <!-- Grid Row 3: Output-->
          <!-- Output TextBox named 'txtOutput' >-->
          <TextBox x:Name="txtOutput" Grid.Row="3" Grid.ColumnSpan="4" Background="Black" BorderBrush="Green" 
              AcceptsReturn="False" Foreground="LightGray" FontFamily="Courier New"  
              IsHitTestVisible="False" FontSize="{StaticResource PhoneFontSizeSmall}" TextWrapping="Wrap" />
          <Button Content="Listen" Grid.Column="1" Grid.ColumnSpan="2" Height="70" HorizontalAlignment="Left" Margin="195,0,0,0" Name="Listenbutton" VerticalAlignment="Top" Width="125" Click="Listenbutton_Click" />
          </Grid>
      </Grid>

      <!--Sample code showing usage of ApplicationBar-->
      <!--<phone:PhoneApplicationPage.ApplicationBar>
          <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
          <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
          <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
          <shell:ApplicationBar.MenuItems>
              <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
              <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
          </shell:ApplicationBar.MenuItems>
          </shell:ApplicationBar>
      </phone:PhoneApplicationPage.ApplicationBar>-->

      </phone:PhoneApplicationPage>

MainPage.xaml.cs

  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Net;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Animation;
  using System.Windows.Shapes;
  using Microsoft.Phone.Controls;
  using System.Net.Sockets;
  using System.Threading;


  namespace UDPClient
  {
  public partial class MainPage : PhoneApplicationPage
  {
  // Constructor
  public MainPage()
  {
  InitializeComponent();
  }

  // Constants
  const int ECHO_PORT = 7;  // The Echo protocol uses port 7 in this sample
  const int QOTD_PORT = 17; // The Quote of the Day (QOTD) protocol uses port 17 in this sample
  const int UDP_PORT = 4502;
  /// <summary>
  /// Handle the btnEcho_Click event by sending text to the echo server and outputting the response
  /// </summary>
  private void btnEcho_Click(object sender, RoutedEventArgs e)
  {
  // Clear the log 
  ClearLog();

  // Make sure we can perform this action with valid data
  if (ValidateRemoteHost() && ValidateInput())
  {
      // Instantiate the SocketClient
      SocketClient client = new SocketClient();
      SocketAsyncEventArgs socketEventArg; 

      // Attempt to send our message to be echoed to the echo server
      Log(String.Format("Sending '{0}' to server ...", txtInput.Text), true);
      string result = client.Send(txtRemoteHost.Text, ECHO_PORT, txtInput.Text, false, out socketEventArg);
      Log(result, false);

      // Receive a response from the echo server
      Log("Requesting Receive ...", true);
      result = client.UDPReceive(ECHO_PORT, false);
      Log(result, false);

      // Close the socket connection explicitly
      client.Close();
  }

  }

  private void Listenbutton_Click(object sender, RoutedEventArgs e)
  {
  // Clear the log 
  ClearLog();

  // Make sure we can perform this action with valid data
  if (ValidateRemoteHost())
  {
      // Instantiate the SocketClient
      SocketClient client = new SocketClient();

      // Receive packets
      string result = client.UDPReceive(UDP_PORT, false);
      Log(result, false);
      // Close the socket connection explicitly
      client.Close();
  }
  }

  /// <summary>
  /// Handle the btnGetQuote_Click event by receiving text from the Quote of the Day (QOTD) server and outputting the response
  /// </summary>
  private void btnGetQuote_Click(object sender, RoutedEventArgs e)
  {
  // Clear the log 
  ClearLog();
  // Receive response from the QOTD server
  Log("nothing...", true);;
  }
  }

  #region UI Validation
  /// <summary>
  /// Validates the txtInput TextBox
  /// </summary>
  /// <returns>True if the txtInput TextBox contains valid data, False otherwise</returns>
  private bool ValidateInput()
  {
  // txtInput must contain some text
  if (String.IsNullOrWhiteSpace(txtInput.Text))
  {
      MessageBox.Show("Please enter some text to echo");
      return false;
  }

  return true;
  }

  /// <summary>
  /// Validates the txtRemoteHost TextBox
  /// </summary>
  /// <returns>True if the txtRemoteHost contains valid data, False otherwise</returns>
  private bool ValidateRemoteHost()
  {
  // The txtRemoteHost must contain some text
  if (String.IsNullOrWhiteSpace(txtRemoteHost.Text))
  {
      MessageBox.Show("Please enter a host name");
      return false;
  }

  return true;
  }
  #endregion

  #region Logging
  /// <summary>
  /// Log text to the txtOutput TextBox
  /// </summary>
  /// <param name="message">The message to write to the txtOutput TextBox</param>
  /// <param name="isOutgoing">True if the message is an outgoing (client to server) message, False otherwise</param>
  /// <remarks>We differentiate between a message from the client and server 
  /// by prepending each line  with ">>" and "<<" respectively.</remarks>
  private void Log(string message, bool isOutgoing)
  {
  string direction = (isOutgoing) ? ">> " : "<< ";
  txtOutput.Text += Environment.NewLine + direction + message;
  }

  /// <summary>
  /// Clears the txtOutput TextBox
  /// </summary>
  private void ClearLog()
  {
  txtOutput.Text = String.Empty;
  }
  #endregion
}
}

SocketClient.cs

  using System;
  using System.Net;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Documents;
  using System.Windows.Ink;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Animation;
  using System.Windows.Shapes;
  using System.Net.Sockets;
  using System.Threading;
  using System.Text;

  namespace UDPClient
  {
  public class SocketClient
  {
  // Cached Socket object that will be used by each call for the lifetime of this class
  Socket _socket = null;
  // Signaling object used to notify when an asynchronous operation is completed
  static ManualResetEvent _clientDone = new ManualResetEvent(false);
  // Define a timeout in milliseconds for each asynchronous call. If a response is not received within this 
  // timeout period, the call is aborted.
  const int TIMEOUT_MILLISECONDS = 1000;
  // The maximum size of the data buffer to use with the asynchronous socket methods
  const int MAX_BUFFER_SIZE = 2048;
  bool isHasSent = false;
  int errorCode = 0;

  /// <summary>
  /// SocketClient Constructor
  /// </summary>
  public SocketClient()
  {
  // The following creates a socket with the following properties:
  // AddressFamily.InterNetwork - the socket will use the IP version 4 addressing scheme to resolve an address
  // SocketType.Dgram - a socket that supports datagram (message) packets
  // PrototcolType.Udp - the User Datagram Protocol (UDP)
  _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
  }

  /// <summary>
  /// Send the given data to the server using the established connection
  /// </summary>
  /// <param name="serverName">The name of the server</param>
  /// <param name="portNumber">The number of the port over which to send the data</param>
  /// <param name="data">The data to send to the server</param>
  /// <returns>The result of the Send request</returns>
  public string Send(string serverName, int portNumber, string data, bool isBroadcast, out SocketAsyncEventArgs socketEventArg)
  {
  string response = "Operation Timeout";
  // Create SocketAsyncEventArgs context object

  // We are re-using the _socket object that was initialized in the Connect method
  if (_socket != null)
  {
      socketEventArg = new SocketAsyncEventArgs();
      // Set properties on context object

      System.Diagnostics.Debug.WriteLine("Send(): setting remoteEndPoint");
      if (isBroadcast)
      socketEventArg.RemoteEndPoint = new IPEndPoint(IPAddress.Broadcast, portNumber);
      else
      socketEventArg.RemoteEndPoint = new DnsEndPoint(serverName, portNumber);
      System.Diagnostics.Debug.WriteLine("Send(): remoteEndPoint correctly set");

      // Inline event handler for the Completed event.
      // Note: This event handler was implemented inline in order to make this method self-contained.
      socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
      {
      response = e.SocketError.ToString();
      // Unblock the UI thread
      _clientDone.Set();

      isHasSent = true; 
      });

      // Add the data to be sent into the buffer
      byte[] payload = Encoding.UTF8.GetBytes(data);
      socketEventArg.SetBuffer(payload, 0, payload.Length);

      // Sets the state of the event to nonsignaled, causing threads to block
      _clientDone.Reset();

      // Make an asynchronous Send request over the socket
      _socket.SendToAsync(socketEventArg);

      // Block the UI thread for a maximum of TIMEOUT_MILLISECONDS milliseconds.
      // If no response comes back within this time then proceed
      _clientDone.WaitOne(TIMEOUT_MILLISECONDS);
  }
  else
  {
      socketEventArg = null;
      response = "Socket is not initialized";
  }

  return response;
  }

  public String UDPReceive(int portNumber, bool isBroadcast)
  {
  SocketAsyncEventArgs socketEventArg;

  System.Diagnostics.Debug.WriteLine("calling Send(\"server\", portNumber, \" \", isBroadcast, out socketEventArg)");
  Send("servern", portNumber, " ", !isBroadcast, out socketEventArg);
  Thread.Sleep(1000);

  while (!isHasSent)
  {
      Thread.Sleep(1);
  }
  System.Diagnostics.Debug.WriteLine("calling Receive(portNumber, isBroadcast, socketEventArg)");
  return Receive(portNumber, isBroadcast, out socketEventArg);
  } 

  /// <summary>
  /// Receive data from the server
  /// </summary>
  /// <param name="portNumber">The port on which to receive data</param>
  /// <returns>The data received from the server</returns>
  public string Receive(int portNumber, bool isBroadcast, out SocketAsyncEventArgs socketEventArg)
  {
  string response = "Operation Timeout";

  // We are receiving over an established socket connection
  if (_socket != null)
  {
      // Create SocketAsyncEventArgs context object
      socketEventArg = new SocketAsyncEventArgs();

      System.Diagnostics.Debug.WriteLine("Receive(): setting remoteEndPoint");
      if (isBroadcast)
      socketEventArg.RemoteEndPoint = new IPEndPoint(IPAddress.Broadcast, portNumber);
      else 
      socketEventArg.RemoteEndPoint = new IPEndPoint(IPAddress.Any, portNumber);
      System.Diagnostics.Debug.WriteLine("Receive(): remoteEndPoint correctly set");

      // Setup the buffer to receive the data
      socketEventArg.SetBuffer(new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE);
      System.Diagnostics.Debug.WriteLine("Receive(): SetBuffer() correctly called");

      // Inline event handler for the Completed event.
      // Note: This even handler was implemented inline in order to make this method self-contained.
      socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
      {
      if (e.SocketError == SocketError.Success)
      {
          System.Diagnostics.Debug.WriteLine("Receive(): SocketError.Success");
          // Retrieve the data from the buffer
          response = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
          response = response.Trim('\0');
      }
      else
      {
          System.Diagnostics.Debug.WriteLine("Receive(): SocketError.Error");
          response = e.SocketError.ToString();
      }
      System.Diagnostics.Debug.WriteLine("Receive(): Set()");
      _clientDone.Set();
      });

      System.Diagnostics.Debug.WriteLine("Receive(): Reset()");
      // Sets the state of the event to nonsignaled, causing threads to block
      _clientDone.Reset();

      try
      {
      // Make an asynchronous Receive request over the socket
      _socket.ReceiveFromAsync(socketEventArg);
      }
      catch (SocketException sockEx)
      {
      Console.WriteLine(sockEx.Message);
      Console.WriteLine(sockEx.ErrorCode);
      Console.WriteLine(sockEx.StackTrace);
      Console.ReadLine();
      System.Diagnostics.Debug.WriteLine("errorCode=" + errorCode + " " + sockEx.Message + sockEx.ErrorCode + sockEx.StackTrace);
      errorCode = 11;
      response += "errorCode=" + errorCode + " " + sockEx.Message + sockEx.ErrorCode + sockEx.StackTrace;
      }
      catch (Exception ex)
      {
      Console.WriteLine(ex.Message);
      Console.WriteLine(ex.StackTrace);
      Console.ReadLine();
      System.Diagnostics.Debug.WriteLine("errorCode="+errorCode+" "+ex.Message + ex.StackTrace);
      errorCode = 22;
      response += "errorCode="+errorCode+" "+ex.Message + ex.StackTrace;
      }
      // Block the UI thread for a maximum of TIMEOUT_MILLISECONDS milliseconds.
      // If no response comes back within this time then proceed
      System.Diagnostics.Debug.WriteLine("Receive(): _clientDone.WaitOne(TIMEOUT_MILLISECONDS)");
      _clientDone.WaitOne(TIMEOUT_MILLISECONDS);
  }
  else
  {
      socketEventArg = null;
      response = "Socket is not initialized";
  }
  System.Diagnostics.Debug.WriteLine("Receive(): response = " + response);
  return response;
  }

  /// <summary>
  /// Closes the Socket connection and releases all associated resources
  /// </summary>
  public void Close()
  {
  if (_socket != null)
  {
      _socket.Close();
  }
  }
}
}

端口 4502 在 Windows Phone 的 Silverlight 中不需要,但仅在浏览器的 Silverlight 应用程序上需要。我正在检查您的代码,因为我有同样的问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Windows Phone 7 通过 wifi 接收 UDP 数据包(广播或单播) 的相关文章

  • 套接字发送并发保证

    如果我在两个进程 或两个线程 之间共享一个套接字 并且在这两个进程中我尝试发送一条阻塞的大消息 大于下划线协议缓冲区 是否可以保证这两个消息将按顺序发送 或者消息可以在内核内部交错吗 我主要对 TCP over IP 行为感兴趣 但了解它是
  • 如何解除阻塞在 ServerSocket.accept() 上的线程?

    我有一个带有以下代码的服务器线程 public void run try ServerSocket server EneaLog printLog Server is running server new ServerSocket this
  • 安装Lua套接字库

    要么我太累了 要么我瞎了 我想学习 Lua 网络 因此我必须安装socketlib 所以我可以轻松地要求它 但我不知道我应该 要求 哪些文件 例子说 local socket require socket 但正如我所说 如果我使用 我不知道
  • P2P网络游戏/应用程序:类似“战网”匹配服务器的不错选择

    我正在制作一个网络游戏 1v1 游戏中是 p2p 不需要游戏服务器 然而 为了让玩家能够 找到彼此 而不需要在另一种媒介中协调并输入IP地址 类似于网络游戏的现代时代 我需要有一个协调 匹配服务器 我无法使用常规网络托管 因为 客户端将使用
  • 是否可以找到哪个用户位于 localhost TCP 连接的另一端?

    这是一个编程问题 但它是 Linux Unix 特定的 如果我从本地主机获得 TCP 连接 是否有一种简单的方法可以告诉哪个用户在 C 程序内建立了连接而无需 shell 我知道这对于 Unix 域套接字来说并不太难 我已经知道远程 IP
  • Socket.*Async 方法是线程化的吗?

    我目前正在尝试找出最小化 TCP 主服务器中使用的线程数量的最佳方法 以便最大限度地提高性能 由于我最近阅读了大量 C 5 0 的新异步功能 异步并不一定意味着多线程 这可能意味着将有限状态对象分成较小的块 然后通过交替与其他操作一起进行处
  • 如何在node.js中分离TCP套接字消息

    我正在尝试使用 TCP 套接字 并且对消息如何到达我的应用程序感到困惑 看来他们已经分手了 有人知道我怎样才能最好地将他们重新组合在一起吗 所有消息均以换行符分隔 r n var stream net createConnection po
  • 无法分配请求的地址 - 可能的原因?

    我有一个由主服务器和分布式从服务器组成的程序 从属服务器向服务器发送状态更新 如果服务器在固定时间内没有收到特定从属服务器的消息 则会将该从属服务器标记为关闭 这种情况一直在发生 通过检查日志 我发现从站只能向服务器发送一个状态更新 然后永
  • 如何从 WinRT StreamSocket 读取所有可用数据并清空 inputStream?

    我想在向套接字写入新数据之前读取当前正在等待套接字的所有数据 WinRT中的读取方法都是异步的 所以我不能简单地while直到套接字为空 由于我确实想丢弃套接字上的数据 因此我不想使用读取器 而是直接从套接字读取数据IInputStream
  • 如何在java中通过socket发送Image数据类型

    我真的很困惑如何通过套接字发送图像数据类型 请帮我 我已经搜索了如何将 Image 数据类型转换为 char 但结果是 0 Use ImageIO http docs oracle com javase 1 4 2 docs api jav
  • Netty Nio java 中的通信

    我想在 Netty nio 中创建一个具有两个客户端和一个服务器的通信系统 更具体地说 首先 我希望当两个客户端与服务器连接时从服务器发送消息 然后能够在两个客户端之间交换数据 我正在使用本示例提供的代码 https github com
  • Java/Python 中的快速 IPC/Socket 通信

    我的应用程序中需要两个进程 Java 和 Python 进行通信 我注意到套接字通信占用了 93 的运行时间 为什么通讯这么慢 我应该寻找套接字通信的替代方案还是可以使其更快 更新 我发现了一个简单的修复方法 由于某些未知原因 缓冲输出流似
  • Socket.io 400(错误请求)

    我的服务器上有这段代码 var express require express var routes require routes var user require routes user var http require http var
  • 使用PHP套接字发送和接收数据

    我正在尝试通过 PHP 套接字发送和接收数据 一切正常 但是当我尝试发送数据时 PHP 不发送任何内容 Wireshark 告诉我发送的数据长度为 0 我正在使用这段代码
  • Linux TUN/TAP:无法从 TAP 设备读回数据

    问题是关于如何正确配置想要使用 Tun Tap 模块的 Linux 主机 My Goal 利用现有的路由软件 以下为APP1和APP2 但拦截并修改其发送和接收的所有消息 由Mediator完成 我的场景 Ubuntu 10 04 Mach
  • C# 获取系统上 Socket.ReceiveBufferSize 和 Socket.SendBufferSize 的最大值

    我们的高吞吐量应用程序 1gbps 从大的 ReceiveBufferSize 和 SendBufferSize 中受益匪浅 我注意到在我的机器上 我可以拥有 100 MB 的缓冲区大小 没有任何问题 但在某些客户端和测试机器上 最大值略高
  • 安装 Python 3.5 包“socket”pycharm 时出错

    仅使用 PyCharm 或命令提示符无法安装此软件包 Collecting socket Using cached socket 0 5 tar gz Complete output from command python setup py
  • 中断连接套接字

    我有一个 GUI 其中包含要连接的服务器列表 如果用户单击服务器 则会连接到该服务器 如果用户单击第二个服务器 它将断开第一个服务器的连接并连接到第二个服务器 每个新连接都在一个新线程中运行 以便程序可以执行其他任务 但是 如果用户在第一个
  • 如何将udp发送到udp node.js服务器?

    我对此很陌生 所以我真的不知道我在做什么 但我已经设置了一个 node js udp 服务器 我想从客户端 来自网站 向它发送一个数据包 但我不知道如何在 javascript 中做到这一点 或者是否可能 我不是在研究如何从 Node js
  • 链路范围 IPv6 多播数据包突然无法在 MacBook Pro 上路由?

    这是一个有点晦涩的问题 但我很困惑 我想也许有人对这个问题有更多的线索 我的同事已经在他的 MacBook Pro 上成功运行了一个使用 IPv6 多播的内部应用程序几个月了 但今天 Mac 决定停止路由多播数据包 特别是 该程序打印此错误

随机推荐

  • HandlerThread 中的 NullPointerException

    这个错误让我困惑了几个小时 我正在得到空指针异常 问题是这个错误不一致 当我启动应用程序时会发生这种情况 但只是偶尔 所以我不确定是什么原因造成的 对于错误日志中的冗长问题 我深表歉意 但我找不到其他询问方式 错误日志如下 FATAL EX
  • 查找某个表的数据来源-ORACLE

    这可能是一个微不足道的问题 但是 由于我正在处理很久以前由其他人创建的数据库 没有包含适当的文档或注释 所以我遇到了一个关键问题 我需要知道数据如何插入到某个表中 有没有脚本或者其他方法可以识别数据源 换句话说 我需要知道数据是否是通过某些
  • 仅允许视频嵌入代码 (Rails)

    我想知道是否有人知道一种方法 只允许将来自 youtube vimeo blip tv 等的代码嵌入到表单字段中 我的网站上有一个表单 允许用户嵌入视频 但我只希望他们添加嵌入代码 html 而不添加任何其他危险的内容 例如 JS 或其他
  • 使用 node-inspector 调试 karma-jasmine 测试

    几乎同样的问题使用 node inspector 调试 jasmine node 测试 https stackoverflow com questions 6162920 debugging jasmine node tests with
  • Xcode 11 beta 无法将应用程序上传到 TestFlight

    我正在尝试将我的应用程序分发到 TestFlight 目前我的应用程序需要 iOS 13 以及 NFC 访问 在 iOS 13 结束测试版之前 我不打算发布我的应用程序 但我希望我的 QA 团队能够对其进行测试 我可以从 Xcode 11
  • 多个图表延迟问题,SVG 还是 HTML5 Canvas?

    我正在寻找使用 Javascript 构建动态且交互式的多个图表 在此练习中涉及同时移动 平移多个图表 我已经使用 SVG 和各种图表库实现了这个练习 然而 我发现当我开始拥有超过 12 个图表时 平移渲染变得缓慢 Highcharts 库
  • 在 C# 中,Array.ToArray() 是否执行深度复制?

    这应该是一个非常基本的问题 但我在找到明确的答案时遇到了一些困难 当你有一个值数组并使用 ToArray 方法 它创建数组的深副本还是浅副本 No 您可以通过编写一个小程序进行测试来轻松验证这一点
  • PHP 警告: include(/var/www/html/....../lib/Cake/Error/ErrorHandler.php): 无法打开流错误

    我在尝试加载网页时遇到此错误 错误消息中显示的路径是 PHP 警告 包括 var www html test com www products abc lib Cake Error ErrorHandler php 无法打开流 它无法找到
  • Angular 6 Universal 不等待解析器完成

    我刚刚安装了 Angular Universal 启动套件版本6并在其中创建了我的组件 该组件应在加载时通 过 API 获取用户信息并将其显示以供查看 问题是 API 结果显示在浏览器中 但未显示在 查看源代码 什么叫普惠如此 My get
  • 变量神秘消失? AWS 代码构建

    接下来是我的 buildspec yml build commands IMAGE TAG cat package json grep version head 1 awk F print 2 sed s g echo IMAGE TAG
  • 如何防止 WKWebView 对象崩溃?

    Scenario 我正在用 Swift 构建一个 iOS 应用程序 其中一项功能是将实时视频源作为应用程序背景 视频源源自本地网络上的 Raspberry Pi 使用sudo motion Motion 已成功在默认端口上托管源8081 S
  • 如何调整撬片颜色

    Edit 褪色的灰色仅是 0 9 7 3 及之前版本的问题 此后它已更改为深灰色 Pry 具有很好的着色功能 但是创建或更改对象时返回的值是褪色的灰色 我几乎看不到 u User new gt
  • 在 R 中搜索列表条目的索引

    给定一个 R 列表 我希望找到给定列表条目的索引 例如 对于条目 36 我希望我的输出是 2 另外 我如何使用 lapply 并行执行此类查询 gt list 1 1 7 12 26 29 2 1 11 36 3 1 20 49 4 1 3
  • 为什么 isnan 含糊不清以及如何避免它?

    Since isnan可以是宏 在 C 98 中 或命名空间中定义的函数std 在 C 11 中 这个简单的示例说明了编写在两种情况下都有效的代码的明显 可能是天真的 方法 include
  • iOS Objective C 中的单例不会阻止多个实例

    我知道有几个关于此的主题 但没有一个回答我的问题 我已经像这样实现了我的单例类 意识到有关单例的争议 MyClass sharedInstance static MyClass sharedInstance nil static dispa
  • OpenIdDict 不从 .Net Core API 返回令牌

    我有一个 Net Core API 项目 我在其中使用 OpenIDDict 进行身份验证 我在那里提到官方存储库 https github com openiddict openiddict samples blob dev sample
  • 如何跟踪页面上的链接被点击的位置?

    我正在接管一个具有三列布局的网站的开发 左侧 菜单 内容横幅 主要 内容 右侧 内容横幅 他们 网站所有者 使用内容横幅来宣传重要内容 我试图让他们明白 根据人类阅读模式的 P 形状 位于右下角 右栏 底部 的项目实际上对访问者来说是不可见
  • 手动输入日期时 md-datepicker 显示错误

    我正在使用 md datepicker 当我手动输入日期时 它显示无效日期 但如果我从此控件中选择日期 则它会被验证 为此我使用了以下代码
  • 在 PHP Foreach 循环之外使用变量

    我试图在 foreach 循环之外输出用户名和用户电子邮件 我正在尝试向特定用户角色内的所有 WordPress 用户发送电子邮件 这是我的代码 Get users and their roles user args array role
  • Windows Phone 7 通过 wifi 接收 UDP 数据包(广播或单播)

    我已经看了好几天有关 Windows Phone 7 的各个论坛 但没有一个给我明确的答案 到目前为止 我还无法接收从通过 wifi 连接到 Windows Phone 7 设备 在模拟器上运行 的计算机发送的 UDP 数据包 既不是广播也