VisM with VB.net Connection "Server Receive Timed Out" - vb.net

I added a VisM control into vb.net via adding a reference to VisM.ocx and adding it in my toolbox as an activeX control.
I added the following code in a button:
Try
'open the connection
AxVisM1.Connect("CN_IPTCP:127.0.0.1[57772]", "LIVEDATA")
'do stuff.
MsgBox("Cache is now active")
'close the connection
AxVisM1.DeleteConnection()
Catch ex As Exception
'close the connection
AxVisM1.DeleteConnection()
MsgBox(ex.ToString)
End Try
however when I run the application the connection hangs, followed by a messagebox that says "Server Receive Timed Out".
I have tried turning off my firewall, and even my antivirus. How will I resolve this? Also, is what I am trying an effective way to access GLOBALS variables in VB.net??

I'm not familiar with VisM, but you using wrong port, and this port only for web, try to change it to 1972, which is used by default. Your server may use another one. Your real port number you can find at System Management Portal on page About (link in the header), and parameter is - Superserver Port.

Related

"the rpc server is unavailable" when trying to do some process on local html file with autohotkey

I have written the script that accesses the local HTML file and does some job.
^+A::
;Convert HTML TO ASCIIDOC
Send ^c
copied := Clipboard
sleep 30
local := "file:///C:/Users/emre/Desktop/Tools/Note%20Taking%20Tools/Asciidoc%20Tools/HtmlToAsciidoc-master/to-asciidoc.html"
sleep 100
(pwb5 := ComObjCreate("InternetExplorer.Application")).Visible:=False
pwb5.navigate(local)
while pwb5.busy
sleep 15
WinActivate,ahk_class IEFrame
ControlFocus,ahk_class IEFrame
Send, !n
Send, {Enter}
pwb5.document.getElementByID("source").value=copied
pwb5.document.getElementByID("conversion-button").Click()
Sleep 3000
Clipboard=pwb5.document.getElementByID("target").value
Return
When I run this script I get following error:
I have done some research and try following things but neither of these work.Any advice appreciated.
Check 1
I have checked DCOM Server Process Launcher, Remote Procedure Call (RPC) and RPC Endpoint Mapper from services.msc.All their status is Running and their startup is set to Automatic.
Check 2
I have also checked "Remote Assistance" from Firewall
Check 3
I have also checked that "File and Printer Sharing for Microsoft Networks" and "Internet Protocol Version 6 (TCP/IPv6)" are enabled
Check 4
I have also checked "to switch the NIC from the default "NAT" to "Bridged Adapter" from Virtualbox settings.
MAYBE this will help. My issue sounds similar to yours. In my case, I have a vb.net program, part of which does something to the effect of the following:
Function LoadWebPage(i_IE As SHDocVw.InternetExplorer, i_URL As String) As Boolean
i_IE.navigate (i_URL)
Debug.Print (i_IE.ReadyState)
End Function
The navigate method ran fine. But once it got to the point of returning the ReadyState property, I was getting the "RPC Server is unavailable" error. This was only happening on one of the three machines I was using. On the machine with the problem, I ran through the steps (which I saw listed in many other sites as well) you mentioned in your question, with no improvement. But then I came across a suggestion to adjust the "Internet Explorer Options-->Settings-->Security-->Enable Protected Mode". Actually the site that helped me said to make sure that they are checked for all of the zones (i.e., Internet, Local intranet, Trusted sites, Restricted sites). Actually it was unchecking them all that resolved my issue. I went back to one of the other two machines (one of those where the script was running without error), and indeed, they were unchecked on that machine (not sure yet about the 3rd machine).
Fix for RPC Server Error when occuring with attempt at Internet Explorer Automation
In case that post doesn't outlast this response, their stated reason for this issue:
"The basic gist of it is when you cross a security domain (http to
https) the sandboxing system actually creates a new IE COM
object...The basic solution is to set all of the security modes in the
Security tab of Internet Settings to 'protected mode enabled'(sic) to
avoid losing COM objects."
Again, I think that may have been a typo on their part and that they meant that the boxes should be unchecked.

Visual basic UploadFile cannot connect to remote server

I tried to upload file via Visual Basic with UploadFile function.
In documentation I found this step:
My.Computer.Network.UploadFile(
"C:\My Documents\Order.txt",
"http://www.cohowinery.com/upload.aspx", "anonymous", "")
I tried it by myself, it works, but when the FTP ports (20,21) are disabled, it cannot works, and take an error, that is normal I know, but how to fix it? How to check the ports or, check the connection to FTP server before connection?
Generally I use:
If My.Computer.Network.IsAvailable Then...
but this works only with general of internet connection.
Any suggestions how to edit my code, to take down any error?
A simple Try/Catch should work.
Try
My.Computer.Network.UploadFile("","","","")
Catch ex As Exception
'Error happened
End Try

VB.Net checking if a port is open and accepting connections

I'm writing a VB.Net app which connects to a remote server and listens for data on that port.
I've got the following function which checks that the IP/port in question is listening for connections or not. When the process on the remote port is running is works fine but when it's not running rather than the exception handler running I get an ugly dialogue box in Visual Studio rather when I run it.
Any ideas why the exception handler is not firing ?
Private Function testSelectedPort(ip As String, port As Integer) As Boolean
' Function to open a socket to the specified port to see if it is listening
' Connect to socket
Dim testSocket As New System.Net.Sockets.TcpClient()
Try
testSocket.Connect(ip, port)
' The socket is accepting connections
testSocket.Close()
Return True
Catch ex As Exception
' The port is not accepting connections
Return False
End Try
Return False
End Function
The error that's being thrown in "No connection could be made because the target machine actively refused it" and it's being thrown at the testSocket.Connect(ip, port) line.
I thought that it would execute the code in the Catch section if it failed to connect ?
Once the exception is thrown it should be handled by the Catch-block. There are only a few exceptions that are generally not very easy to handle via Try/Catch (for instance a System.AccessViolationException), but those do not include the errors a socket might throw.
Please make sure that you haven't ticked the specific exception type to break when thrown, in the Exception Settings window

WebSocket4Net in SilverLight

I am trying to create a WebSocket client through WebSocket4Net with port 4503.However i could see the the WebSocket status only as "Connecting" as it is neither raising any exceptions nor proceeding further.I was able to throw the Exception OnError Event which states that
"An attempt was made to access a socket in a way forbidden by its access permissions"
Am i missing anything?. Any suggestions or link will be much helpful.Thanks in advance.
ws = new WebSocket("ws://localhost:4503/WSServer");
ws.Opened += new EventHandler<EventArgs>(ws_Opened);
ws.Open();
I've been getting this kind of error today with a different type of socket library. This may be an access permissions problem in Silverlight, but on the server side, I found that I had to shut down Visual Studio, and then launch it with admin permissions in order to start up the service. It's going to be something like that. If it is a Silverlight access permissions thing, you will want to try running it out of browser and turning on elevated trust.

TcpListener actively refused connection

I am maintaining an application that uses a TcpListener to listen for incoming communication. The following code opens the connection:
Dim listener As TcpListener
_listenFailed = False
Try
listener = New TcpListener(System.Net.IPAddress.Parse(Me.Host), Me.Port)
listener.Start()
Catch ex As Exception
' an error here means the settings are likely bogus
_listenFailed = True
Return
End Try
While Not _stoplistening
{
' Accept connection
}
The problem that I am having is that when i send a file from a different computer, I get the error "No connection could be made because the target machine actively refused it."
I have checked for firewalls and antivirus, and there were no blocks. I used
netstat -a -n
to determine that the port is active and listening. Both applications are running from Visual Studios in Administrator mode, not that this should make a difference. I have a break point set at the first line of the accept connection code, but it never gets run.
I stopped the application and examined the TcpListener, and found that there were a couple errors if I dug deep down. At TcpListener.LocalEndpoint.IPEndPoint.IPAddress.Address.ErrorCode there was the error 10045, "OperationNotSupported". Also, at TcpListener.Socket.RemoteEndPoint.ErrorCode there was an error 1057, "A request to send or receive data was disallowed because the socket is not connected, and (when sending on a datagram socket using a sendto call) no address was supplied. I don't know if either of these errors are relevant.
If anyone has any insights as to what might be causing this problem, or steps that can be taken to trace the root of the issue, I would be grateful.
Try changing this:
listener = New TcpListener(System.Net.IPAddress.Parse(Me.Host), Me.Port)
To this:
listener = New TcpListener(System.Net.IPAddress.Any, Me.Port)
This will allow you to listen across all network interfaces.
Additionally, you can use IPv6Any instead of Any if you want to target IPv6 instead. This choice has an impact on the address used by the client side obviously.