Tony512

hi!

on my smartphone i have 2 different GPRS connection...one connects to "the internet" and the other to "Work".

usually if i open a socket and send some data i use "The Internet" connection, right

how can i open a socket and send some data over "Work" connection



Re: .NET Compact Framework [c#]Change Connection

AndrewBadera

you need to look up the GUID for the connection from the registry, and specify the GUID for the connection you wish to use.



Re: .NET Compact Framework [c#]Change Connection

Tony512

but how can i change it



Re: .NET Compact Framework [c#]Change Connection

Ilya Tumanov

You can do that via Connection Manager API. OpenNetcf.org has managed wrapper or you could P/Invoke it yourself.






Re: .NET Compact Framework [c#]Change Connection

Tony512

something like this should work

TcpClient socket1= new TcpClient();

TcpClient socket2= new TcpClient();

//data pass throught "Work" connection

DestinationInfoCollection DIC = conn.EnumDestinations();

foreach (DestinationInfo di in DIC)

{

if (di.description == "Work")

{

conn.Connect(di.guid, true, ConnectionMode.Asynchronous);

}

}

socket1.Connect("xxxxxxxxx", zzz);

StreamWriter scrivi = new StreamWriter(socket1.GetStream());

scrivi.Write("data string");

}

//now data pass throught "The Internet" connection

foreach (DestinationInfo di in DIC)

{

if (di.description == "The Internet")

{

conn.Connect(di.guid, true, ConnectionMode.Asynchronous);

}

}

socket2.Connect("aaaa", bbbb);

StreamWriter scrivi = new StreamWriter(socket2.GetStream());

scrivi.Write("data string");

}





Re: .NET Compact Framework [c#]Change Connection

Panos_gr

tony have you managed to accomplish that

i am struggling to accomplish this exact thing!