I get this error when I use a host Ip in a server I am trying to set up. This has never happened before.
# Host Credentials
host = '192.068.0.3'
port = '4445'
I am met with this error, right at the .068:
invalid syntax (<unknown>, line 12)pylint(syntax-error)
Really, how can this be? I'm using Visual Studio Code as my text editor.
Related
I am trying to make a connection from a server running Ubuntu to a Beckhoff PLC with TwinCAT 3. With Windows everything works fine but with the same server on Linux I can't get a connection.
The Linux server has a static IP and in the route manager in the PLC I can find the route and see the server. I have tried adding the route by the route manager in the PLC and with "add_route_to_plc" but both ways my connection is refused. I have already turned off all firewalls. Any of you guys any idea what goes wrong here? In the attachment I have added some picture to see my settings and code that I try to run.
Python error: "connection closed by remote"
Python code:
import pyads
SENDER_AMS = '192.168.1.180.1.1'
PLC_IP = '192.168.1.100'
PLC_USERNAME = 'Administrator'
PLC_PASSWORD = '1'
ROUTE_NAME = 'GID_TEST_ROUTE'
HOSTNAME = 'Grid-stabilizer'
pyads.open_port()
pyads.set_local_address(SENDER_AMS)
pyads.add_route_to_plc(SENDER_AMS, HOSTNAME, PLC_IP, PLC_USERNAME, PLC_PASSWORD, route_name=ROUTE_NAME)
pyads.close_port()
plc=pyads.Connection('192.168.1.100.1.1', pyads.PORT_TC3PLC1)
plc.open()
plc.read_state()
If you are running python on linux and the plc on windows try
plc=pyads.Connection('192.168.1.100.1.1', pyads.PORT_TC3PLC1, PLC_IP)
This will create a route on the linux system. In your code the ip is missing to create a proper route.
Check the port of your plc. It should be 851.
I've created a MySQL In App database for my Azure App, and got the connection string for it. This string is injected into the application.json, and then used to create the actual connection:
WebApplicationBuilder builder = // get it somewhere
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
builder.Services.AddDbContext<DatabaseContext>(options => options.UseMySQL(connectionString));
Only... no connection string works. The one with the port (Database=localdb;Data Source=127.0.0.1:53844;User Id=azure;Password=password) throws:
System.Net.Sockets.SocketException (11001): No such host is known.
And the one without the port (Database=localdb;Data Source=127.0.0.1;User Id=azure;Password=password) throws:
System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions.
This question sugested another connection string (Server=127.0.0.1; Port=53844; Database=localdb; Uid=azure; Pwd=password), which weirdly enough also throws this exception, even though the port is defined:
System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions.
And the manual suggests yet another string (server=localhost;database=localdb;user=azure;password=password) which again throws one of the two exceptions depending on if the port is present.
Connecting via the browser works fine, so I can confirm port, username and password work normally.
Just to be sure, I tried "localhost" as the host, too. Same results.
What am I doing wrong?
It's a mix out of all these connection strings:
server=localhost;port=53844;database=localdb;user=azure;password=password
(Port and server separated, but both present.)
Works for me right now.
In my ssh client I am using ssh_userauth_none before calling ssh_userauth_list(). But it always returns SSH_AUTH_ERROR. When I try to find out the reason for error using ssh_get_error() it says Socket error: disconnected.
I have used the same code on other linux machine (Ubuntu), it works fine. But when I try it on an embedded machine which is based on CentOS linux, it always fails with the error -SSH_AUTH_ERROR.
Am I missing any fields in ssh_config file which makes none authentication to work?.
Or is it related to some username/path issue?
I am trying to setup my outgoing email from Sharepoint on premises.
I need to configure smtp settings by the script given on IIS official web , but I received an error
\windows\system32\inetsrv\appcmd set config /commit:WEBROOT /section:smtp /from:webmaster#mydomain.com /deliveryMethod:network /network.port:80 /network.defaultCredentials:False /network.host:smtp.host.com /network.userName:web#mydomain.com /network.password:password
But the error I get after executing above script is
Error Message: Unknown Attribute "deliveryMethod" ..Resaon: Enum must be one of network, specified Pickup directories.
I am unable to track this error and unable to find relevant solution to the issue
Network in this case is not a command, but a parameter and is case sensitive. Set the variable to "Network" instead of "network" and retry the command.
I have been using the following code for months (without problem) in a .NET 2.0/3.5 environment:
string server="192.168.1.3";
IPHostEntry ipe = System.Net.Dns.GetHostEntry(server);
IPAddress ipa = ipe.AddressList[0];
IPEndPoint ipep = new IPEndPoint(ipa, (int)UdpServices.Domain);
Here, server is hardcoded to an IP address, but in my application it could potentially be something like "server.test.com".
When converting my project to .NET 4.0, this code stopped working when directly passing an IP address (still works with a hostname). It crashes with this exception:
System.Net.Sockets.SocketException was unhandled
Message=The requested name is valid, but no data of the requested type was found
Source=System
ErrorCode=11004
NativeErrorCode=11004
StackTrace:
at System.Net.Dns.InternalGetHostByAddress(IPAddress address, Boolean includeIPv6)
at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
Because all I need is the resulting IPEndPoint, I can work around the issue by using IPAddress.Parse to generate the IPAddress object, but I want to know if any of you know why this behaviour changed in .NET 4.0? (If we can't resolve the hostname from the IP address, an exception is now thrown).
Microsoft answered this here:
this was purposely changed to more
consistently represent name resolution
failures. If you have input strings
that you just want to convert to
IPAddresses, it is recommended that
you use IPAddress.TryParse or
Dns.GetHostAddresses