Forums

Set up twisted on port 5000

I got my invite today, and I'm trying to run my twisted chat server to test if PythonAnywhere support it well. I put the server to listening on interface: socket.gethostbyname(socket.gethostname()), port: 5000 and it gives a strange IP(10.122.89.215), I can't connect with my client. There's a way to run twisted non-web servers?

Hi Yst,

Currently our firewall/sandbox model doesn't allow for users to make ad-hoc socket connections... We host user's web apps via WSGI - so things like django and web.py, which are used to working with Apache/WSGI, are fine, but standalone/async web servers don't work.

We plan to allow raw socket connections in a future release though...

I'd like to add my 2 cents to this request. I'd also like to create raw socket connections for various applications.

Thanks, Matt

+1 for socket connections

+1 for sockets

Thanks, guys. I've +1d the ticket for each of you.

+1

I'd like to be able to use my own sockets as well. Any info on when this feature will be available?

Guys, I suspect that using your own ports will be a premium feature as it will mean assigning a new public IP address to you - and IP addresses are far from free...

Actually I assumed that people wouldn't be able to pick their specific port numbers - they'd request a port and be assigned an arbitrary one. Since there's around 64,000 available ports per IP address then this should allow quite a bit of capacity. Some form of NAT could be used to translate these to different ports in the virtual machines, which would allow applications to stick to the port numbers they're used to. However, it's a pretty poor application which doesn't have a configurable for the port number.

I could still quite understand it being a premium feature, of course - there's likely to be quite a bit of implementation still required, and even just the administrative overhead would be a pain. Also, having to pay even a little bit is probably one of the most effective ways to stop abuses - perhaps you pay a certain amount per 5 or 10 port numbers allocated, for example.

Of course, being able to pick your own port numbers is also a potential premium feature but then you're getting quite far on the road to complete VPS solutions, and I would imagine that's going to incur a higher cost (if it's even implemented at all).

My suggestion would be to implement just being assigned port numbers initially and see how it works out, but it may be that the direct mapping is easier to implement for some reason.

The problem is that it's hard for us to ensure that each person keeps the same IP address, even if they're sharing it with other people.

However, for HTTP and WebSockets apps, we should be able to support socket servers, even on the default ports. The reason is that these protocols both put a Host: line in the header when a client initiates a connection, so we can put an nginx or haproxy server up and route everyone's stuff through to the appropriate servers and ports. There's a bit of complexity with HTTPS, but we've done experiments that suggest that it's all fixable.

Unfortunately I can't give a timeframe right now, though. It's on our list, and I've added an upvote for you, Mobious, but it's not at the top of the list yet.

Has this been updated, I noticed this is from over a year ago.

No. The architectural changes that would be necessary are slowly moving up the priority list, but we don't have a firm idea of when we might get to this.