I am developing a program which uses windows sockets to obtain data from a server using the Modbus protocol. The server provides information in groups called menus. Each menu is displayed via a separate view.

Can any one provide a suggestion to implement the data transfer elements. My idea.

1. Each View is responsible for creating a socket to facilitate the transfer of data required to populate the view when the view is show (view becomes visible).
2. Each view will initiate the required requests for data and the processing of the received data, when visible.
3. When the view is removed from view (hidden) the socket used for the transfer of data will be closed.

Would it be more efficient to open one socket when the connection to the server is required and provide access to this socket to all views, and close the socket when the application exits?

Thanks in advance for you comments