Bibliotheken, die einen net.Conn akzeptieren können, dürften ohne Änderungen funktionieren.
Limits und Einschränkungen
Die Socket-Unterstützung in App Engine unterliegt den folgenden Einschränkungen:
Sie können keinen Socket erstellen, der auf eingehende Verbindungen wartet; nur ausgehende Sockets können erstellt werden.
FTP wird nicht unterstützt.
Sie können nur TCP oder UDP verwenden. Beliebige Protokolle sind nicht erlaubt.
Sie können Sockets nicht an bestimmte IP-Adressen oder Ports binden.
Port 25 (SMTP) ist blockiert; Sie können weiterhin authentifiziertes SMTP auf dem Übermittlungsport 587 verwenden.
Private, Broadcast-, Multicast- und Google-IP-Bereiche (mit Ausnahme der unten aufgelisteten) sind blockiert:
Google Public DNS: 8.8.8.8, 8.8.4.4, 2001:4860:4860::8888, 2001:4860:4860::8844 Port 53
Gmail SMTPS: smtp.gmail.com Port 465 und 587
Gmail POP3S: pop.gmail.com Port 995
Gmail IMAPS: imap.gmail.com Port 993
Socket-Deskriptoren sind der App Engine-Anwendung zugeordnet, mit der sie erstellt wurden, und nicht übertragbar. Sie können also nicht von anderen Anwendungen genutzt werden.
Sockets können nach zehn Minuten Inaktivität zurückgewonnen werden. Jeder Socket-Vorgang hält den Socket für weitere zehn Minuten aktiv.
Sockets mit dem Entwicklungsserver verwenden
Sie können Code mithilfe von Sockets auf dem Entwicklungsserver ausführen und testen, ohne spezielle Befehlszeilenparameter zu verwenden.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThis socket API is outdated and only compatible with the Go 1.11 runtime, requiring migration to a recommended solution before upgrading to Go 1.12 or later.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine supports outbound socket connections through the \u003ccode\u003eappengine/socket\u003c/code\u003e package, with traffic billed as outgoing bandwidth.\u003c/p\u003e\n"],["\u003cp\u003eSocket functionality in App Engine is limited to outbound connections, prohibiting the creation of listening sockets and supporting only TCP or UDP protocols.\u003c/p\u003e\n"],["\u003cp\u003eCertain ports and IP ranges are restricted, including port 25 (SMTP) and private, broadcast, or multicast IP ranges, with exceptions for specific Google services like DNS and Gmail.\u003c/p\u003e\n"],["\u003cp\u003eSockets are tied to the App Engine app that creates them and can be automatically reclaimed after 10 minutes of inactivity.\u003c/p\u003e\n"]]],[],null,["# Sockets API for legacy bundled services\n\n| **Caution:** **This solution is no longer recommended:** Apps that use this API can only run in the Go 1.11 runtime and will need to upgrade to a [recommended solution](/appengine/migration-center/standard/services/migrating-services) before migrating to the Go 1.12+ runtime.\n\nTraffic from sockets is billed as [outgoing bandwidth](/appengine/docs/pricing#Billable_Resource_Unit_Costs). App Engine supports outbound sockets through the [`appengine/socket` package](/appengine/docs/legacy/standard/go111/reference/latest/socket).\n\n\u003cbr /\u003e\n\nLibraries that can accept a `net.Conn` should work without modification.\n\n\nLimitations and restrictions\n----------------------------\n\nSocket support in App Engine has the following limitations:\n\n- You cannot create a listen socket; you can only create outbound sockets.\n- FTP is not supported.\n- You can only use TCP or UDP; arbitrary protocols are not allowed.\n- You cannot bind to specific IP addresses or ports.\n- Port 25 (SMTP) is blocked; you can still use authenticated SMTP on the submission port 587.\n- Private, broadcast, multicast, and Google IP ranges are blocked, except\n those listed below:\n\n - Google Public DNS: `8.8.8.8`, `8.8.4.4`, `2001:4860:4860::8888`, `2001:4860:4860::8844` port 53\n - Gmail SMTPS: `smtp.gmail.com` port 465 and 587\n - Gmail POP3S: `pop.gmail.com` port 995\n - Gmail IMAPS: `imap.gmail.com` port 993\n\n | **Note:** Google Compute Engine IP addresses are not considered to be in Google IP ranges. You can use sockets to connect App Engine apps to Compute Engine instances.\n- Socket descriptors are associated with the App Engine app that\n created them and are non-transferable (cannot be used by other apps).\n\n- Sockets may be reclaimed after 10 minutes of inactivity; any socket operation\n keeps the socket alive for a further 10 minutes.\n\n\n Using sockets with the development server\n -----------------------------------------\n\n You can run and test code using sockets on the development server, without using\n any special command line parameters."]]