The Mango toolkit has sockets, but not the current one. You can create a web service with UPnP functions and wrap it so that it can be used by your application. This is not as effective as using it directly from the device, but as far as I know, this is the only viable option.
source
share