Making a connection to APNs with bluehost server - python

I wrote some code to connect to APNs and it works great on my local machine. But when I upload and try to run it on my bluehost server it just takes a long time and then times out. After further testing I can't even get connected to the aps at all. I try
telnet gateway.sandbox.push.apple.com 2195
Connection timed out
I am thinking it has something to do with my bluehost configuration. I have a dedicated IP address and have bluehost claims that port 2195 is open. Any ideas on why I might not be able to make a connection?

After talking with tech support a second time the problem was that port 2195 wasn't open for outgoing connections. They got it opened and I am now in business.

Related

Why telegram bot doesn't conflict with nginx?

I wrote a simple telegram bot and it works great without conflicting with my firewall. But my question is this, in the firewall I have ports 80 and 443 allowed for my site, but when I write a TCP socket in Python that should work through port 443 or port 80, the OS tells me that I need to run the program from the user's root, but if I start the bot, then the OS does not swear at all about the rights and the bot works quietly. If I still decide to run a socket on port 443 or 80, then the OS replies that these ports are busy.
So, please explain to me why the telegram bot does not conflict with processes and ports?
My server is Ubuntu 22.04
P.S. I already asked this question on stackexchange, but as I understand it, they do not understand telegram bots, I hope you can help me.
Oh... too much misunderstandings in your question. It will be better to understand basics of TCP connection and NAT tables first.
I will try to explain this situation in short
when I write a TCP socket in Python that should work through port 443 or port 80, the OS tells me that I need to run the program from the user's root
80 and 443 are privileged ports and Linux doesn't allow to use it under non-admin users. It has nothing to do with Nginx conflicts and may be solved by proper configuration
If you will try to use non-privileged port like 8080 python may be executed even without admin permissions
So, please explain to me why the telegram bot does not conflict with processes and ports?
Nginx and Python socket are listening at 80 and 443 ports and waiting for incoming connections. You have to access your server IP to initiate connection
Telegram bot (and any another bot) are using Telegram servers to connect. Just imagine that you instantly looking in Telegram app and immediately answering on all messages. Bot doing the same stuff. It is just client for remote server (You don't need to listen 443 at your machine to be able use Telegram app, right?). It is listening no port and don't waiting for incoming connections but waiting for messages at remote server
But you can argue "Hey stop, but Python bot still connected to Telegram servers. What ports it uses? Isn't that is same as the socket?" → Here is the same TCP connection, but Python using OUTGOING dynamic ports to connect Telegram server's INCOMING static port 443. Outgoing port may be 20323 or 27578 for example. It is all about NAT. In short any non-used port may be used to establish connection between remote 443 and local XXXX ports.
You're confusing two things, I think.
nginx/apache/a python server process trying to listen on port 443 or 80 need to be run by root (or another user with elevated privilege levels).
A python bot trying to talk to a telegram server on port 443 doesn't have that limitations; browsers also don't need to run as root.
If this doesn't answer your question you need to be a bit clearer on what you're doing.

Forward a FTP port via UPnP in Python

I am making a Python application that requires the server to have an FTP port forwarded to his computer(a Rasberry PI3) in order to communicate with client. The current implementation works quite great, yet the only thing is that the person who's running the file must forward the port to the local IP manually. I want to automate this. I have serached a lot but i didnt find anything.

Struggling to access imap servers in windows 10

I am looking to connect to my Hotmail inbox and downloads mails from a client of mine, for which I built a python script to create a report.
The issue I have is that I inevitably get the following:
[Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
With the exact (very basic) same code, a friend of mine connects without any problem. He is on Linux, I am on Windows10. I have tried to turn off the firewall, uninstalled MacAfee, created a rule to allow the inbound traffic through the ports 143 and 993 ... but nothing changes. When I run the diagnosis tool on the port 143 and 993, they appear as closed.
I am just an usual PC user with no particular training on ports, SSL, but I have looked quite hard.
Sending an email using STMP works without any problem.
Would you have a solution??
import imapclient
HOST = 'imap-mail.outlook.com'
server = imapclient.IMAPClient(HOST, use_uid=True, ssl=False)

PyCharm remote debugging (pydevd) does not connect

PyCharm remote debugging (pydevd) does not connect with the following message:
error: [Errno 10061] No connection could be made because the target machine actively refused it
How can I troubleshoot it?
The output console in PyCharm shows:
Starting debug server at port 21000
Use the following code to connect to the debugger:
import pydevd
pydevd.settrace('*.*.*.*', port=21000, suspend=False)
Waiting for process connection...
Server stopped.
I checked the firewall and PyCharm is allowed for both incoming and outgoing connections.
10061 is WSAECONNREFUSED, 'connection refused', which means there was nothing listening at the IP:port you tried to connect to.
Though I see that you have validated its not a firewall issue, but still I would suggest to check the port numbers again with respect to the ones opened in windows firewall. Or to narrow down just run a simplehttpserver or icmp server at the same port and confirm.
In a direct link communication, it often means that you have already something connected to this port.
To check what process is hearing what port, check this SO question.
You can then either kill the program or change the port, depending of what you can do.
Without more information of the "remote tested", it is hard to know what is happening.
I was having the trouble as well (Server stopped as soon as the client connected).
Turned out that I had apparently too many breakpoints defined.
after having removed most of them and re-initiated my remote debug connection from the client (and having restarted the debug server in pycharm) it doesn't trigger anymore the "Server stopped." problem.

Incoming ZeroMQ traffic dropped by server due to NAT?

I have a ZMQ server listening on port 12345 TCP. When another server connects on that port locally or via VM it works fine, but if I try from a remote server that has to go through port forwarding on my Fios firewall it just bombs. The packets are showing up in Wireshark but ZMQ just ignores them. Is there anyway to get past this?
You shouldn't be able to bind more than once to the same port number, either from the same process or another.
ZMQ should give a failure when you issue bind with a port number already in use. Are you checking return codes?

Categories

Resources