SORU
23 Kasım 2012, Cuma


Windows UDP çok noktaya yayın grup 8 Telefon

TAMAM bu bir kaç gündür anlamaya çalışıyorum. Windows bir uygulama telefonu çok noktaya yayın grubuna katılmak ve grup mesaj gönderme ve alma birbirleriyle konuşmak için sonra Nereye Phone 7 var. Not - bu telefonu iletişim telefonu.

Windows için bu uygulama bağlantı noktası için çalışıyorum şimdi 8 - Telefon 8 Dönüştür " Visual Studio 2012 - buraya kadar çok iyi özelliği kullanarak Telefon Telefon iletişim için telefonu test etmeye çalışırım kadar. Yakışıklı grup iyi katılmak gibi görünüyor, ve veri birimi TAMAM gönderiyorlar. Hatta bu grup için gönderdikleri iletileri alıyorsunuz ancak, yakışıklı hiç başka bir telefon mesajı alır.

İşte örnek kod sayfama arkasında:

// Constructor
public MainPage()
{
    InitializeComponent();
}

// The address of the multicast group to join.
// Must be in the range from 224.0.0.0 to 239.255.255.255
private const string GROUP_ADDRESS = "224.0.1.1";

// The port over which to communicate to the multicast group
private const int GROUP_PORT = 55562;

// A client receiver for multicast traffic from any source
UdpAnySourceMulticastClient _client = null;

// Buffer for incoming data
private byte[] _receiveBuffer;

// Maximum size of a message in this communication
private const int MAX_MESSAGE_SIZE = 512;

private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
    _client = new UdpAnySourceMulticastClient(IPAddress.Parse(GROUP_ADDRESS), GROUP_PORT);
    _receiveBuffer = new byte[MAX_MESSAGE_SIZE];

    _client.BeginJoinGroup(
        result =>
        {
            _client.EndJoinGroup(result);
            _client.MulticastLoopback = true;
            Receive();
        }, null);
}

private void SendRequest(string s)
{
    if (string.IsNullOrWhiteSpace(s)) return;

    byte[] requestData = Encoding.UTF8.GetBytes(s);

    _client.BeginSendToGroup(requestData, 0, requestData.Length,
        result =>
        {
            _client.EndSendToGroup(result);
            Receive();
        }, null);
}

private void Receive()
{
    Array.Clear(_receiveBuffer, 0, _receiveBuffer.Length);
    _client.BeginReceiveFromGroup(_receiveBuffer, 0, _receiveBuffer.Length,
        result =>
        {
            IPEndPoint source;

            _client.EndReceiveFromGroup(result, out source);

            string dataReceived = Encoding.UTF8.GetString(_receiveBuffer, 0, _receiveBuffer.Length);

            string message = String.Format("[{0}]: {1}", source.Address.ToString(), dataReceived);
            Log(message, false);

            Receive();
        }, null);
}

private void Log(string message, bool isOutgoing)
{
    if (string.IsNullOrWhiteSpace(message.Trim('\0')))
    {
        return;
    }

    // Always make sure to do this on the UI thread.
    Deployment.Current.Dispatcher.BeginInvoke(
    () =>
    {
        string direction = (isOutgoing) ? ">> " : "<< ";
        string timestamp = DateTime.Now.ToString("HH:mm:ss");
        message = timestamp   direction   message;
        lbLog.Items.Add(message);

        // Make sure that the item we added is visible to the user.
        lbLog.ScrollIntoView(message);
    });

}

private void btnSend_Click(object sender, RoutedEventArgs e)
{
    // Don't send empty messages.
    if (!String.IsNullOrWhiteSpace(txtInput.Text))
    {
        //Send(txtInput.Text);
        SendRequest(txtInput.Text);
    }
}

private void btnStart_Click(object sender, RoutedEventArgs e)
{
    SendRequest("start now");
}

Sadece UDP yığın test etmek için şu Web sitesini ziyaret örnek here buldum indirdim ve Windows Phone 7 cihazlar bir çift bu test ve beklendiği gibi çalışır. Daha sonra Windows ve benim el Phone 8 dağıtılan dönüştürülmüş, cihazlar bağlantı gibi tekrar ve kullanıcı adını girin. Ancak, yine bu cihazlar veya diğer cihazlar ile iletişim kuramıyor.

Son olarak basit bir iletişim test new DatagramSocket uygulamasını kullanarak uygulanan ve yeniden başlatma başarılı, ama inter-cihaz iletişim görüyorum.

Bu sayfa arkasında aynı kod UDP soketine uygulama kullanıyor:

// Constructor
public MainPage()
{
    InitializeComponent();
}

// The address of the multicast group to join.
// Must be in the range from 224.0.0.0 to 239.255.255.255
private const string GROUP_ADDRESS = "224.0.1.1";

// The port over which to communicate to the multicast group
private const int GROUP_PORT = 55562;

private DatagramSocket socket = null;

private void Log(string message, bool isOutgoing)
{
    if (string.IsNullOrWhiteSpace(message.Trim('\0')))
        return;

    // Always make sure to do this on the UI thread.
    Deployment.Current.Dispatcher.BeginInvoke(
    () =>
    {
        string direction = (isOutgoing) ? ">> " : "<< ";
        string timestamp = DateTime.Now.ToString("HH:mm:ss");
        message = timestamp   direction   message;
        lbLog.Items.Add(message);

        // Make sure that the item we added is visible to the user.
        lbLog.ScrollIntoView(message);
    });
}

private void btnSend_Click(object sender, RoutedEventArgs e)
{
    // Don't send empty messages.
    if (!String.IsNullOrWhiteSpace(txtInput.Text))
    {
        //Send(txtInput.Text);
        SendSocketRequest(txtInput.Text);
    }
}

private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
    socket = new DatagramSocket();
    socket.MessageReceived  = socket_MessageReceived;

    try
    {
        // Connect to the server (in our case the listener we created in previous step).
        await socket.BindServiceNameAsync(GROUP_PORT.ToString());
        socket.JoinMulticastGroup(new Windows.Networking.HostName(GROUP_ADDRESS));
        System.Diagnostics.Debug.WriteLine(socket.ToString());
    }
    catch (Exception exception)
    {
        throw;
    }
}

private async void SendSocketRequest(string message)
{
    // Create a DataWriter if we did not create one yet. Otherwise use one that is already cached.
    //DataWriter writer;
    var stream = await socket.GetOutputStreamAsync(new Windows.Networking.HostName(GROUP_ADDRESS), GROUP_PORT.ToString());
    //writer = new DataWriter(socket.OutputStream);
    DataWriter writer = new DataWriter(stream);

    // Write first the length of the string as UINT32 value followed up by the string. Writing data to the writer will just store data in memory.
   // stream.WriteAsync(
    writer.WriteString(message);

    // Write the locally buffered data to the network.
    try
    {
        await writer.StoreAsync();
        Log(message, true);
        System.Diagnostics.Debug.WriteLine(socket.ToString());
    }
    catch (Exception exception)
    {
        throw;
    }
    finally
    {
        writer.Dispose();
    }
}

void socket_MessageReceived(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
{
    try
    {
        uint stringLength = args.GetDataReader().UnconsumedBufferLength;
        string msg = args.GetDataReader().ReadString(stringLength);

        Log(msg, false);
    }
    catch (Exception exception)
    {
        throw;
    }
}

Dün gece yakışıklı ev kablosuz ağ, düşük test ve başarılı bir iletişim cihazı alacağım seyretmek için aldım.

Sözün özü - eski Windows Phone 7 kodumu iş benim ağ üzerinde iyi çalışır. Windows için bağlantı noktası Phone 8 (gerçek kod değişikliği) ınter-cihaz iletişim göndermez. Bu kod benim ev ağı üzerinde çalışır. Kod hata ayıklayıcısı ekli ile çalışır ve her yerde yürütme sırasında bir hata veya özel işaretler vardır.

Kullandığım telefonlar

Windows 7 - Nokia Lumia 900 (* 2), Nokia Lumia 800 (* 3)Telefon Windows 8 - Nokia Lumia 920 (* 1), Nokia Limia 820 (* 2), Telefon

Bu en son işletim sistemi destekli ve geliştirici modunda. Geliştirme ortamı Windows 8 Enterprise Visual Studio 2012 Profesyonel çalışıyor

I cant çalışıyorsun kablosuz ağ hakkında çok cihazlar sorun var Telefon 7 den başka söyle.

Ben eskiden evde kablosuz ağ, hiçbiri ile temel BT Broadband router 'kutusunda' ayarlar değişmiş. gibi

Şüphesiz her iki ağ yapılandırılmış olan yol ile ilgili bir sorun var, ama çok önemli bir sorun Windows 8 uygular UDP mesajları Telefon yolu ile.

Herhangi bir giriş, bu beni deli sürüş gibi mutluluk duyacağız.

CEVAP
27 AĞUSTOS 2013, Salı


Bu wordclock düzgün çalışmıyor mu? Başka bir mıdı clock-kaynak, sadece test etmek için Sürüş Yeteneği var mı?

Gerçi şöyle dedi: "ben birçok pro sequencer benim makine ve MIDI dosyaları cezası var", sen de dene http://www.reaper.fm (çalışır Linux/BSD, Mac ve Win) DAW ve ithalat mıdı doğrudan içine, o zaman set varsayılan mıdı aygıtı olarak istediğiniz test ile.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • MysteryGuitarMan

    MysteryGuita

    16 HAZİRAN 2006
  • pucksz

    pucksz

    24 Mart 2006
  • Warner Bros. UK

    Warner Bros.

    6 HAZİRAN 2008