# Visual Basic > Universal Windows Platform and Modern Windows Experience >  Socket programming

## FrankGs

Hello My name is Frank,

I hace a application that is made in VB2010 and I want to make it in metro style.

The first problem I got was that the System.Net.Sockets.TcpClient() was not available in metro and I had to use Windows.Networking.Sockets
I have the connection with the socket but when I try to send the string it give me a error, and I can not find the cause of it.
Has someone expertise in this? wwould be gladly appriciated.

Maybe a little bit of explaning. What am I trying to do.
It is a automation project for a house the use the modules from TSCC http://topsccc.com/htm/product/product-ipc.htm
You can connect to the 9188 module and send messages to a 9060 module what trigger soms switches.


This is the error that I got


```
An exception of type 'System.InvalidOperationException' occurred in Test app bediening.exe but was not handled in user code  
  
Additional information: Er is een methode aangeroepen op een onverwacht tijdstip. (Uitzondering van HRESULT: 0x8000000E)
```

This is the code



```
Private Async Sub btsend_Click(sender As Object, e As RoutedEventArgs) Handles btsend.Click  
Dim s As New Windows.Networking.Sockets.StreamSocket  
Dim writer As New Windows.Storage.Streams.DataWriter(s.OutputStream)  
Dim sendmes As String = "@026" & vbCr  
writer.WriteString(sendmes)  
Await writer.StoreAsync()  
writer.DetachStream()  
End Sub
```

----------

