{"id":13482903,"url":"https://github.com/4thline/cling","last_synced_at":"2025-05-15T16:05:44.604Z","repository":{"id":1659568,"uuid":"2385705","full_name":"4thline/cling","owner":"4thline","description":"UPnP/DLNA library for Java and Android","archived":false,"fork":false,"pushed_at":"2020-02-11T16:56:54.000Z","size":6132,"stargazers_count":1751,"open_issues_count":77,"forks_count":604,"subscribers_count":117,"default_branch":"master","last_synced_at":"2025-04-07T21:13:54.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/4thline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-09-14T14:09:24.000Z","updated_at":"2025-04-07T06:13:53.000Z","dependencies_parsed_at":"2022-08-06T11:00:28.498Z","dependency_job_id":null,"html_url":"https://github.com/4thline/cling","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4thline%2Fcling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4thline%2Fcling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4thline%2Fcling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4thline%2Fcling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4thline","download_url":"https://codeload.github.com/4thline/cling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374427,"owners_count":22060611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:06.595Z","updated_at":"2025-05-15T16:05:44.582Z","avatar_url":"https://github.com/4thline.png","language":"Java","funding_links":[],"categories":["Java","Libs","网络编程","Utility"],"sub_categories":["\u003cA NAME=\"Utility\"\u003e\u003c/A\u003eUtility"],"readme":"# Cling EOL: This project is no longer actively maintained, code may be outdated. If you are interested in maintaining and developing this project, comment [here](https://github.com/4thline/cling/issues/244).\n\n---\n\n## Cling - The UPnP stack for Java and Android\n\nCling is an effort to create a UPnP-compatible software stack in Java. The project's goals are strict specification compliance, complete, clean and extensive APIs, as well as rich SPIs for easy customization.\n\nCling is Free Software, distributed under the terms of the \u003ca href=\"http://www.gnu.org/licenses/lgpl-2.1.html\"\u003eGNU Lesser General Public License\u003c/a\u003e \u003cb\u003eor at your option\u003c/b\u003e the \u003ca href=\"http://opensource.org/licenses/CDDL-1.0\"\u003eCommon Development and Distribution License\u003c/a\u003e.\n\nWe recommend you start with the [README.txt](https://github.com/4thline/cling/blob/master/distribution/src/dist/README.txt).\n\nThen [download the Cling distribution](https://github.com/4thline/cling/releases) or start with a Maven project in your `pom.xml`:\n\n```\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003e4thline-repo\u003c/id\u003e\n        \u003curl\u003ehttp://4thline.org/m2\u003c/url\u003e\n        \u003csnapshots\u003e\n            \u003cenabled\u003efalse\u003c/enabled\u003e \u003c!-- Or true, if you like to use unreleased code --\u003e\n        \u003c/snapshots\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.fourthline.cling\u003c/groupId\u003e\n        \u003cartifactId\u003ecling-core\u003c/artifactId\u003e\n        \u003cversion\u003e2.1.2\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nRead \u003ca href=\"http://4thline.org/projects/cling/core/manual/cling-core-manual.xhtml#chapter.GettingStarted\"\u003ethe first chapter of the manual\u003c/a\u003e for a simple Cling usage example. Have a look at the \u003ca href=\"https://github.com/4thline/cling/tree/master/demo/android\"\u003eAndroid application examples\u003c/a\u003e.\n\n**Please post Cling usage questions on [stackoverflow.com](https://stackoverflow.com/questions/tagged/cling+upnp) with the appropriate tags.**\n\n**See the [forum archive](http://mailinglists.945824.n3.nabble.com/Cling-users-and-developers-Closed-read-only-f945824.html) for older discussions.**\n\n## Cling Modules\n\n### Cling Core\n\nAn embeddable Java library that implements the \u003ca href=\"http://www.upnp.org/resources/documents.asp\"\u003eUPnP Device Architecture 1.0\u003c/a\u003e. Use Cling Core to expose services with a UPnP remoting interface, or to write control point applications that discover UPnP devices and utilize their services. You can also integrate \u003ca href=\"http://4thline.org/projects/cling/core/manual/cling-core-manual.xhtml#chapter.Android\"\u003eCling Core as an Android UPnP/DLNA library in your applications\u003c/a\u003e (platform level 15/4.0 required).\n\n- [User Manual](http://4thline.org/projects/cling/core/manual/cling-core-manual.xhtml)\n- [API Javadoc](http://4thline.org/projects/cling/core/apidocs)\n- [Source XRef](http://4thline.org/projects/cling/core/xref)\n- [Test Source XRef](http://4thline.org/projects/cling/core/xref-test)\n\n### Cling Support\n\nOptional classes and useful infrastructure for developing and controlling UPnP services with Cling Core; extensions that simplify working with UPnP media servers and renderers, \u003ca href=\"http://4thline.org/projects/cling/support/manual/cling-support-manual.xhtml#section.PortMapping\"\u003eNAT port mapping on routers\u003c/a\u003e, etc.\n\n- [User Manual](http://4thline.org/projects/cling/support/manual/cling-support-manual.xhtml)\n- [API Javadoc](http://4thline.org/projects/cling/support/apidocs)\n- [Source XRef](http://4thline.org/projects/cling/support/xref)\n- [Test Source XRef](http://4thline.org/projects/cling/support/xref-test)\n\n### Cling Workbench\n\nA desktop application for browsing UPnP devices and interacting with their services.\n\n### Cling MediaRenderer\n\nStandalone \u003ca href=\"http://www.upnp.org/resources/documents.asp\"\u003eUPnP MediaRenderer\u003c/a\u003e, based on gstreamer.\n\nBuilding Cling\n---------------------\n\n* Install Maven 3.2.3 or newer.\n\n* Install the Android SDK and set the ANDROID_HOME environment variable to the SDK install directory.\n\n* Clone the Cling source:\n\n````\ngit clone https://github.com/4thline/cling.git\n````\n\n* Change into the `cling/` directory.\n\n* Install everything into your local `~/.m2` Maven repository (this will take a few minutes if all dependencies have to be downloaded for the first time).\n\n````\nmvn clean install\n````\n\nIf your build fails with Android/dex packaging errors, you forgot the clean.\n\n* Use Cling in your pom.xml with:\n\n````\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.fourthline.cling\u003c/groupId\u003e\n    \u003cartifactId\u003ecling-core\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.2\u003c/version\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n````\n\nBuilding OS X Workbench DMG\n---\n\n    hdiutil create -srcfolder \\\n        workbench/target/cling-workbench-2.1.2/Cling\\ Workbench.app \\\n        workbench/target/cling-workbench-2.1.2/Cling\\ Workbench.dmg\n\nPublishing a release\n--------------------\n\nBuild release and tag on Github.\n\nUpdate Maven repository:\n\n\n````\nmvn clean install\nmvn clean deploy -DskipTests\n````\n\n## Projects and applications using Cling\n\nIf your project or product is using Cling and you'd like to add it to this page, open an issue and we'll add you to the list.\n\n* \u003ca href=\"https://market.android.com/details?id=com.bubblesoft.android.bubbleds\"\u003eBubbleDS\u003c/a\u003e - A UPnP control point for Android and \u003ca href=\"http://linn.co.uk/digital_stream_players\"\u003eLinnDS\u003c/a\u003e streamer appliances.\n\n* \u003ca href=\"https://market.android.com/details?id=com.bubblesoft.android.bubbleupnp\"\u003eBubbleUPnP\u003c/a\u003e - A generic UPnP/DLNA media control point and renderer for Android.\n\n* \u003ca href=\"https://github.com/jinzora/\"\u003eJinzora UPnP\u003c/a\u003e - The Jinzora music management and streaming server can be accessed through a UPnP MediaServer gateway written with Cling. The Android client also uses Cling to access the MediaServer.\n\n* \u003ca href=\"https://market.android.com/details?id=com.adree.moviebrowser.upnp\"\u003eMovieBrowser UPnP\u003c/a\u003e - A movie manager to use with your favorite player on your Android tablet. Manage your videos anywhere on your network (Samba \u0026amp; UPnP/DLNA) and watch them with your favorite player or using the unique Play-To feature (Android airplay).\n\n* \u003ca href=\"https://market.android.com/details?id=com.abk.privatedancer\"\u003ePrivate Dancer\u003c/a\u003e - A  UPnP/DLNA Media Renderer for Android. It is designed to be used on a device attached to speakers and power. Unlike other UPnP Android applications, Private Dancer is designed for always-on (headless) use.\n\n* \u003ca href=\"https://play.google.com/store/apps/details?id=com.dbapp.android.mediahouse\"\u003eMediaHouse\u003c/a\u003e - Stream music, videos, movies and pictures from PC, NAS or any other device running UPnP/DLNA compliant media server to your Android phone/handset/tablet.\n\n* \u003ca href=\"https://play.google.com/store/apps/details?id=be.wyseur.photo\"\u003eDigital Photo Frame Slideshow\u003c/a\u003e - Turn your Android device in a digital photo viewer showing a slideshow of local files, photos from network shares (Samba/SMB) or pictures from a UPnP server.\n\n* \u003ca href=\"http://www.i-frame.net\"\u003eI-Frame Home\u003c/a\u003e - Full HD digital photo frame, picture-like design, displays files located in internal memory, LAN or Internet.\n\n* \u003ca href=\"https://play.google.com/store/apps/details?id=de.simatex.free.mediaconnect\"\u003eMediaConnect\u003c/a\u003e - Enables you to connect mediaservers with mediaplayers and also remote control these mediaplayers within a WLAN.\n\n* \u003ca href=\"https://play.google.com/store/apps/details?id=de.simatex.free.mediaconnect\"\u003eMediaConnect\u003c/a\u003e - MediaConnect enables you to connect mediaservers with mediaplayers and also remote control these mediaplayers within a WLAN.\n\n* \u003ca href=\"https://play.google.com/store/apps/details?id=de.mip.shufflebox.android\"\u003eShuffleBox\u003c/a\u003e - Use your smartphone or tablet as a remote control and play music on your laptop, mobile phone or any other DNLA device.\n\n* \u003ca href=\"https://github.com/trishika/DroidUPnP\"\u003eDroidUPnP\u003c/a\u003e - A FREE SOFTWARE UPnP control point application for Android. DroidUPnP discover your home UPnP device, content provider and renderer. It allows you to browse your UPnP content directory, select the media you want to use and allows you to play it on your connected television or any UPnP renderer compatible device. It also allows you to use your Android device as a UPnP content provider.\n\n* \u003ca href=\"http://www.yaacc.de/\"\u003eYAACC\u003c/a\u003e -An Android UPnP controller, FREE SOFTWARE as GPL. It allows you to discover, use and control UPnP devices in your network in order to stream media files. Since it's a subset of UPnP it also is capable of communicating with DLNA devices.\n\n## Noteworthy forks of Cling\n\n* \u003ca href=\"http://www.openhab.org/jupnp/\"\u003ejUPnP\u003c/a\u003e - Forked from pre-2.0, this code base still contains the OSGi feature, which has been removed in Cling 2.0.\n\n* \u003ca href=\"https://github.com/COLTRAM/cling\"\u003eDIAL Support\u003c/a\u003e - Based on alpha 2.0 code, this UPnP/DLNA library for Java and Android contains modifications to discover DIAL devices.\n\n## FAQ\n\n#### Which version of the UPnP specification does Cling implement?\n\nCling Core is compatible with the [UPnP Device Architecture 1.0](http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.0.pdf).\n\n\n#### Can I use Cling to access a UPnP/DLNA MediaServer in Android?\n\nYes, you can write a control point application for Android with Cling Core as a UPnP library. You can find additional utilities for browsing and parsing a MediaServer content directory in the Cling Support module. \n\n#### Can I use Cling in my commercial application or device?\n\nCling is licensed under the LGPL, so there are no restrictions on the use of the unmodified Cling JAR files/binaries. You can use the unmodified JAR files/binaries in any application or device, for any purpose. The following distribution (for free or for pay) restrictions apply:\n \n* If you distribute Cling with your application or device, you have to include a notice like \u0026quot;contains LGPL software\u0026quot; and a link to the Cling homepage, so your users also get the benefit of Free Software.\n\n* You have to allow replacement of the Cling library in your distributed application. This means allowing replacement of the Cling JAR or JVM binary class file(s) in, for example, a WAR or EAR package.\n\n* For Cling 1.x, the following \u003cb\u003eexception for static linking of an executable\u003c/b\u003e (see \u003ca href=\"https://www.gnu.org/licenses/lgpl.html\"\u003eLGPLv3 clause 4\u003c/a\u003e or LGPLv2 clause 6b) applies to Cling usage within \u003cb\u003eAndroid applications\u003c/b\u003e and the DEX instead of the JVM binary format: Converting Cling's binary JVM class files to the DEX format, and distributing a combined work as an Android APK does not affect the licensing of other resources within that DEX or APK archive. You must however allow re-packaging/conversion of the DEX and APK with tools such as \u003ca href=\"http://code.google.com/p/dex2jar/\"\u003edex2jar\u003c/a\u003e. Anyone receiving your APK must be able to replace the Cling binary code with a compatible version. You can \u003ci\u003enot\u003c/i\u003e lock your APK with any kind of obfuscation or DRM scheme, or otherwise prevent unpacking and reassembly of the DEX containing Cling binaries. Alternatively, consider \u003ca href=\"http://android-developers.blogspot.ch/2011/07/custom-class-loading-in-dalvik.html\"\u003e dynamic loading of libraries on Android\u003c/a\u003e.\n                 \n* For Cling 2.x, you may at your option license Cling under CDDL instead of the LGPL. You can convert to DEX and package Cling 2.x within an APK without affect on other files in that APK. You can obfuscate the source in the APK and lock it with digital restrictions. If you modify Cling source code, and you distribute a binary compiled from this modified source code, you have to distribute your changed source code as well under the LGPL or CDDL (upon request). Typically this means you contribute your changes back to the Cling project, to be included in an official Cling release.\n\n\u003ca href=\"mailto:license(at)4thline.com\"\u003eContact us\u003c/a\u003e if you have questions about the licensing of Cling and/or require a proprietary license.\n\n#### What are the dependencies of Cling Core?\n\nCling Core is distributed as a single JAR file. It only has one other dependency, the `seamless-*` libraries. All JAR files are typically packaged next to each other in the ZIP distribution. You have to add them to your classpath.\n\n#### How can I access the services of a device?\n\nFirst write a control point and a `RegistryListener` as explained \u003ca href=\"http://4thline.org/projects/cling/core/manual/cling-core-manual.xhtml#section.BinaryLightClient\"\u003ein the manual\u003c/a\u003e. Then call `device.getServices()` when a device has been discovered.\n\n#### Cling doesn't work if I start my application on Tomcat/JBoss/Glassfish/etc?!\n\nYou'll get an error on startup, this error tells you that Cling couldn't use the Java JDK's `HTTPURLConnection` for HTTP client operations. This is an old and badly designed part of the JDK: Only \u0026quot;one application\u0026quot; in the whole JVM can configure it. You have to switch Cling to an alternative HTTP client, e.g. the other bundled implementation based on Apache HTTP Core. This is explained in more detail in \u003ca href=\"http://4thline.org/projects/cling/core/manual/cling-core-manual.xhtml#section.BasicAPI.UpnpService.Configuration\"\u003e the user manual\u003c/a\u003e.\n\n#### Is IPv6 supported?\n\nNo, the default configuration of the UPnP stack in Cling Core will filter all network interfaces and IP addresses that are not IPv4. Some other parts of the Cling Core library might also assume that addresses are IPv4 and the whole library has not been tested in an IPv6 only environment. You are welcome to test Cling on IPv6 with a custom \u003ctt\u003eUpnpServiceConfiguration\u003c/tt\u003e and \u003ctt\u003eNetworkAddressFactory\u003c/tt\u003e and contribute back any necessary changes.\n\n#### I don't see debug log messages on Android?\n\nThe `java.util.logging` implementation on Android is broken, it does not allow you to print debug-level messages easily. See [this discussion](https://stackoverflow.com/questions/4561345/how-to-configure-java-util-logging-on-android/9047282#9047282) for a simple solution.\n\n#### Where can I find the source for Cling 1.x and teleal-common?\n\n\u003ca href=\"http://4thline.org/projects/download/archive/\"\u003eHere.\u003c/a\u003e\n\n#### Wich version of Android (API) is supported by Cling?\n\nCling 1.0 supports Android 2.1. With Cling 2.0, we currently require platform level 15 (Android 4.0.3).\n\n#### I get a lock acquisition timeout exception?\n\nYour service receives a subscription, then this happens:\n\n```\nRuntimeException at org.teleal.cling.protocol.sync.ReceivingSubscribe.responseSent(ReceivingSubscribe.java:177)\n```\n\nYour service was already being used by something else and didn't give up the lock during the 500 millisecond default wait time. Increase the wait time by overriding DefaultServiceManager in LocalService. Or don't block the service action/methods for a long time.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4thline%2Fcling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4thline%2Fcling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4thline%2Fcling/lists"}