Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

Sockets API for legacy bundled services

Traffic from sockets is billed as outgoing bandwidth. App Engine supports outbound sockets through the appengine/socket package.

Libraries that can accept a net.Conn should work without modification.

Limitations and restrictions

Socket support in App Engine has the following limitations:

  • You cannot create a listen socket; you can only create outbound sockets.
  • FTP is not supported.
  • You can only use TCP or UDP; arbitrary protocols are not allowed.
  • You cannot bind to specific IP addresses or ports.
  • Port 25 (SMTP) is blocked; you can still use authenticated SMTP on the submission port 587.
  • Private, broadcast, multicast, and Google IP ranges are blocked, except those listed below:

    • Google Public DNS:,, 2001:4860:4860::8888, 2001:4860:4860::8844 port 53
    • Gmail SMTPS: port 465 and 587
    • Gmail POP3S: port 995
    • Gmail IMAPS: port 993
  • Socket descriptors are associated with the App Engine app that created them and are non-transferable (cannot be used by other apps).

  • Sockets may be reclaimed after 10 minutes of inactivity; any socket operation keeps the socket alive for a further 10 minutes.

    Using sockets with the development server

    You can run and test code using sockets on the development server, without using any special command line parameters.