none
hostname = 0x03c8d9a8 <无可用信息,未为 Windows.Networking.Connectivity.dll 加载任何符号> RRS feed

答案

  • 有异常抛出吗?未加载符号属于正常现象,如果你没有开启Debug的symbol或者你没有为你的库添加symbol文件连接,在debug时候他无法被加载符号,只是会导致无法定位调用符号位置,但与运行没有关系。这个符号只是用于更友好的显示调用信息,是给我们看的,对运行无实际意义。

    你的代码,有个问题,ConnectAsync异步执行之后并没有.then 来等待去执行下面的代码。


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    • 已标记为答案 Eric_00101 2012年10月9日 7:45
    2012年9月26日 10:00
    版主

全部回复

  • 具体什么代码?

    请详细描述问题,能尽可能的提供些信息,不要让我们猜谜语, :)


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    2012年9月26日 3:27
    版主
  • void TestSocket::MainPage::Button_Click_2(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)

    {

    HostName^ hostname = ref new HostName("58.68.221.22");

    String^ str = ref new String(L"80"); 

    StreamSocket^ socket = ref new StreamSocket();

        StreamSocketListener^ listener = ref new StreamSocketListener();

        ListenerContext^ listenerContext = ref new ListenerContext(rootPage, listener);

    listener->ConnectionReceived += ref new TypedEventHandler<StreamSocketListener^, StreamSocketListenerConnectionReceivedEventArgs^>(  listenerContext,&ListenerContext::OnConnection);

    task<void>(socket->ConnectAsync(hostname, str, SocketProtectionLevel::PlainSocket));

    DataWriter^ writer;

        writer = ref new DataWriter(socket->OutputStream);

    String^ stringToSend("Hello");

        writer->WriteUInt32(writer->MeasureString(stringToSend));

        writer->WriteString(stringToSend);

        task<unsigned int>(writer->StoreAsync()).then([this, socket, stringToSend] (task<unsigned int> writeTask)

        {

        });

    }

    上面的代码在调试的时候 显示:hostname 0x033ae618 <无可用信息,未为 Windows.Networking.Connectivity.dll 加载任何符号>

    2012年9月26日 4:12
  • 有异常抛出吗?未加载符号属于正常现象,如果你没有开启Debug的symbol或者你没有为你的库添加symbol文件连接,在debug时候他无法被加载符号,只是会导致无法定位调用符号位置,但与运行没有关系。这个符号只是用于更友好的显示调用信息,是给我们看的,对运行无实际意义。

    你的代码,有个问题,ConnectAsync异步执行之后并没有.then 来等待去执行下面的代码。


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    • 已标记为答案 Eric_00101 2012年10月9日 7:45
    2012年9月26日 10:00
    版主
  • 我修改了一下,

    //

    // DirectXPage.xaml.cpp

    // DirectXPage.xaml 类的实现。

    //

    #include "pch.h"

    #include "DirectXPage.xaml.h"

    using namespace TestWuyu;

    using namespace Platform;

    using namespace Windows::Foundation;

    using namespace Windows::Foundation::Collections;

    using namespace Windows::Graphics::Display;

    using namespace Windows::UI::Input;

    using namespace Windows::UI::Core;

    using namespace Windows::UI::Xaml;

    using namespace Windows::UI::Xaml::Controls;

    using namespace Windows::UI::Xaml::Controls::Primitives;

    using namespace Windows::UI::Xaml::Data;

    using namespace Windows::UI::Xaml::Input;

    using namespace Windows::UI::Xaml::Media;

    using namespace Windows::UI::Xaml::Navigation;

    using namespace Concurrency;

    using namespace Windows::ApplicationModel::Core;

    using namespace Windows::Networking;

    using namespace Windows::Networking::Sockets;

    using namespace Windows::Storage::Streams;

    DirectXPage::DirectXPage() :

    m_renderNeeded(true),

    m_lastPointValid(false)

    {

    InitializeComponent();

    m_renderer = ref new SimpleTextRenderer();

    m_renderer->Initialize(

    Window::Current->CoreWindow,

    SwapChainPanel,

    DisplayProperties::LogicalDpi

    );

    Window::Current->CoreWindow->SizeChanged += 

    ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &DirectXPage::OnWindowSizeChanged);

    DisplayProperties::LogicalDpiChanged +=

    ref new DisplayPropertiesEventHandler(this, &DirectXPage::OnLogicalDpiChanged);

    DisplayProperties::OrientationChanged +=

            ref new DisplayPropertiesEventHandler(this, &DirectXPage::OnOrientationChanged);

    DisplayProperties::DisplayContentsInvalidated +=

    ref new DisplayPropertiesEventHandler(this, &DirectXPage::OnDisplayContentsInvalidated);

    m_eventToken = CompositionTarget::Rendering::add(ref new EventHandler<Object^>(this, &DirectXPage::OnRendering));

    m_timer = ref new BasicTimer();

    StreamSocket^ socket = ref new StreamSocket();

    HostName^ hostname;

    hostname = ref new HostName("lekan.com");

    task<void>(socket->ConnectAsync(hostname,L"80", SocketProtectionLevel::PlainSocket)).then([this] (task<void> previousTask)

        {

            try

            {

                previousTask.get();

                CoreApplication::Properties->Insert("connected", nullptr);

            }

            catch (Exception^ exception)

            {

            }

        });

    CoreApplication::Properties->Insert("clientSocket", socket);

    }

    void DirectXPage::OnPointerMoved(Object^ sender, PointerRoutedEventArgs^ args)

    {

    auto currentPoint = args->GetCurrentPoint(nullptr);

    if (currentPoint->IsInContact)

    {

    if (m_lastPointValid)

    {

    Windows::Foundation::Point delta(

    currentPoint->Position.X - m_lastPoint.X,

    currentPoint->Position.Y - m_lastPoint.Y

    );

    m_renderer->UpdateTextPosition(delta);

    m_renderNeeded = true;

    }

    m_lastPoint = currentPoint->Position;

    m_lastPointValid = true;

    }

    else

    {

    m_lastPointValid = false;

    }

    }

    void DirectXPage::OnPointerReleased(Object^ sender, PointerRoutedEventArgs^ args)

    {

    m_lastPointValid = false;

    }

    void DirectXPage::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)

    {

    m_renderer->UpdateForWindowSizeChange();

    m_renderNeeded = true;

    }

    void DirectXPage::OnLogicalDpiChanged(Object^ sender)

    {

    m_renderer->SetDpi(DisplayProperties::LogicalDpi);

    m_renderNeeded = true;

    }

    void DirectXPage::OnOrientationChanged(Object^ sender)

    {

    m_renderer->UpdateForWindowSizeChange();

    m_renderNeeded = true;

    }

    void DirectXPage::OnDisplayContentsInvalidated(Object^ sender)

    {

    m_renderer->ValidateDevice();

    m_renderNeeded = true;

    }

    void DirectXPage::OnRendering(Object^ sender, Object^ args)

    {

    if (m_renderNeeded)

    {

    m_timer->Update();

    m_renderer->Update(m_timer->Total, m_timer->Delta);

    m_renderer->Render();

    m_renderer->Present();

    m_renderNeeded = false;

    }

    }

    void DirectXPage::OnPreviousColorPressed(Object^ sender, RoutedEventArgs^ args)

    {

    m_renderer->BackgroundColorPrevious();

    m_renderNeeded = true;

    }

    void DirectXPage::OnNextColorPressed(Object^ sender, RoutedEventArgs^ args)

    {

    m_renderer->BackgroundColorNext();

    m_renderNeeded = true;

    }

    void DirectXPage::SaveInternalState(IPropertySet^ state)

    {

    m_renderer->SaveInternalState(state);

    }

    void DirectXPage::LoadInternalState(IPropertySet^ state)

    {

    m_renderer->LoadInternalState(state);

    }

    void TestWuyu::DirectXPage::Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)

    {

    if (!CoreApplication::Properties->HasKey("connected"))

        {

            return;

        }

    StreamSocket^ socket = dynamic_cast<StreamSocket^>(CoreApplication::Properties->Lookup("clientSocket"));

    DataWriter^ socket_write = ref new DataWriter(socket->OutputStream);

    String^ write_string = ref new String(L"GET / HTTP/1.1\r\nHost: lekan.com\r\nConnection: keep-alive\r\nUser-Agent:Win8\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n\r\n");

    String^ write_string_new = ref new String(L"GET /css/layout.css HTTP/1.0\r\nHost: qq_insite.lekan.com\r\nUser-Agent: Win8\r\n\r\n");

    socket_write->WriteUInt32(socket_write->MeasureString(write_string_new));

        socket_write->WriteString(write_string_new);

    task<unsigned int>(socket_write->StoreAsync()).then([this, socket, write_string_new] (task<unsigned int> writeTask){

    try

            {

                // Try getting an exception.

    printf("%s",writeTask.get().ToString());

            }

            catch (Exception^ exception)

            {

    return;

    }

    });

    // socket_write->Close();

    // socket->Close();

    }

    经过测试,已经可以和服务器通信了但是 用DATAWRITER的时候无法产生请求。


    2012年9月27日 8:45