Gopinath Perumal
Gopinath Perumal

Reputation: 2318

How to use StreamSocketListener and StreamSocket in windows 8 Metro App instead of System.Net.Sockets?

I'm Trying to Migrate my existing GChat application, which is a Windows Form App to Windows 8 Metro App.

In the windows forms application i used,

    System.Net.Sockets.Socket _socket = new new System.Net.Sockets.Socket();

for enable connection to "talk.google.com".

In MetroApp only StreamSocket and DatagramSockets are available I replaced the Code as suggested in this.

Now I dont know whether the connection is enabled or not. . .

When it step into the code

    Windows.Networking.Sockets.StreamSocket sSocket = new Windows.Networking.Sockets.StreamSocket();

    sSocket.Controls.KeepAlive = true;

    await sSocket.ConnectAsync(hostName,"https");

i got the IP address details but the Connection is not alive when it passes the code, it exits.

if anybody know how to handle the socket conection and enable permanant connection in the background in Metro App, please say me!

Thanks in Advance!

Upvotes: 3

Views: 9571

Answers (1)

Typist
Typist

Reputation: 1474

Start with StreamSocket sample. This may be helpful.

Upvotes: 1

Related Questions