Share via

UDP socket shared on multiple page

sébastien DECORME 26 Reputation points
2021-03-11T13:30:53.33+00:00

Hi,
I would like to make an UWP and android application to communicate with an UDP server.
On the first page I've a connected button to launch the connexion with the server.
I've multiple page with Request button on each.
I selected a page and I click on the request button it will will update Entry or Label with informations received by UDP.
How can I send UDP packet when I click on a request(One unique packet by button) to my UDP class instancied on the first page ?

Developer technologies | .NET | Xamarin
Developer technologies | Universal Windows Platform (UWP)
0 comments No comments

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,871 Reputation points
    2021-03-12T03:09:06.853+00:00

    Hello, Welcome to Micorosoft Q&A,

    UDP socket shared on multiple page

    In general, we could use CoreApplication.Properties dictionary to store this socket instance and get it with the key in UWP platform, And Xamarin Forms has same method Application.Current.Properties dictionary that could pass the value.

    For example

     Application.Current.Properties["socket"] = socket;  
    

    Retrieve Instance

     var socket = Application.Current.Properties["socket"] as Socket;  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.