convert to vb.net code

Place for developers to chat about the code
Post Reply
scrollan
Posts: 1
Joined: Sat Nov 05, 2016 6:59 pm

convert to vb.net code

Post by scrollan » Sat Nov 05, 2016 7:10 pm

Hi

I try to convert this C# code To VB.Net

SIPTransport sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine());
SIPUDPChannel udpChannel = new SIPUDPChannel(new IPEndPoint(IPAddress.Any, 5060));
sipTransport.AddSIPChannel(udpChannel);

It would be something like this

Dim sipTransport SIPTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine())
Dim udpChannel SIPUDPChannel = new SIPUDPChannel(new IPEndPoint(IPAddress.Any, 5060))
sipTransport.AddSIPChannel(udpChannel)


But this line won't be converted

Dim sipTransport SIPTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine())

The part "SIPDNSManager.ResolveSIPService" i don't understan.
When i look in to the originating code "ResolveSIPService" actually should be ResolveSIPService(xxx,yyy) or ResolveSIPService(xxx as string).

Can some one explain to me how I can use SIPDNSManager.ResolveSIPService with out passing any arguments?
In VB.Net this won't work because if I change ResolveSIPService to be ResolveSIPService(hostname) it say that this is a endpoint but needs to be endpoint delegate.

Regards
Christian Enroth

User avatar
Aaron
Site Admin
Posts: 4558
Joined: Thu Jul 12, 2007 12:13 am

Re: convert to vb.net code

Post by Aaron » Tue Nov 08, 2016 9:11 am

The SIPDNSManager.ResolveSIPService is a static method. I don't know anything about VB.Net but does the the AddressOf operator work?

Code: Select all

Dim sipTransport SIPTransport = new SIPTransport(AddressOf SIPDNSManager.ResolveSIPService, new SIPTransactionEngine())

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest