All Projects → murielK → Tcpmessenger

murielK / Tcpmessenger

TCPMessenger is a lightweight and simple Android library to send and receive tcp messages.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Tcpmessenger

AsyncTcpClient
An asynchronous variant of TcpClient and TcpListener for .NET Standard.
Stars: ✭ 125 (+941.67%)
Mutual labels:  tcp, tcp-client
ctsTraffic
ctsTraffic is a highly scalable client/server networking tool giving detailed performance and reliability analytics
Stars: ✭ 125 (+941.67%)
Mutual labels:  tcp, tcp-client
SuperSimpleTcp
Simple wrapper for TCP client and server in C# with SSL support
Stars: ✭ 263 (+2091.67%)
Mutual labels:  tcp, tcp-client
Oksocket
An blocking socket client for Android applications.
Stars: ✭ 2,359 (+19558.33%)
Mutual labels:  tcp, tcp-client
Simpleunitytcp
🖧 Simple Unity Project to show how TCP communication are builded in C# without multi-threading or Unity network (Unet) involved.
Stars: ✭ 22 (+83.33%)
Mutual labels:  tcp, tcp-client
tcp server client
A thin and simple C++ TCP client server
Stars: ✭ 124 (+933.33%)
Mutual labels:  tcp, tcp-client
network
exomia/network is a wrapper library around System.Socket for easy and fast TCP/UDP client & server communication.
Stars: ✭ 18 (+50%)
Mutual labels:  tcp, tcp-client
React Native Tcp Socket
React Native TCP socket API for Android, iOS & macOS with client SSL/TLS support
Stars: ✭ 112 (+833.33%)
Mutual labels:  tcp, tcp-client
Hprose Nodejs
Hprose is a cross-language RPC. This project is Hprose 2.0 for Node.js
Stars: ✭ 297 (+2375%)
Mutual labels:  tcp, tcp-client
EasyFileTransfer
An easy way to transfer file with any size on network with tcp protocol.
Stars: ✭ 30 (+150%)
Mutual labels:  tcp, tcp-client
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (+1266.67%)
Mutual labels:  tcp, tcp-client
Bizsocket
异步socket,对一些业务场景做了支持
Stars: ✭ 469 (+3808.33%)
Mutual labels:  tcp, tcp-client
Simpletcp
A minimal non-blocking TCP server written for Python 3.
Stars: ✭ 162 (+1250%)
Mutual labels:  tcp, tcp-client
QTcpSocket
A simple Qt client-server TCP architecture to transfer data between peers
Stars: ✭ 62 (+416.67%)
Mutual labels:  tcp, tcp-client
Tcpgoon
tcpgoon, maximum TCP connections tester
Stars: ✭ 141 (+1075%)
Mutual labels:  tcp, tcp-client
tcp-net
Build tcp applications in a stable and elegant way
Stars: ✭ 42 (+250%)
Mutual labels:  tcp, tcp-client
Packetsender
Network utility for sending / receiving TCP, UDP, SSL
Stars: ✭ 1,349 (+11141.67%)
Mutual labels:  tcp, tcp-client
Simpletcp
Simple wrapper for TCP client and server in C# with SSL support
Stars: ✭ 99 (+725%)
Mutual labels:  tcp, tcp-client
Socketify
Raw TCP and UDP Sockets API on Desktop Browsers
Stars: ✭ 67 (+458.33%)
Mutual labels:  tcp, tcp-client
Tacopie
C++ TCP Library - NO LONGER MAINTAINED
Stars: ✭ 359 (+2891.67%)
Mutual labels:  tcp, tcp-client

TCPMessenger

TCPMessenger will handle the TCP communication and cache between a socket server and the Android application, but also will provide type-safe response defined by a user in the MainThread to facilitate UI update.

How to

public class MainActivity extends AppCompatActivity implements TCPMessenger.Callback<String> {

    private ProgressDialog progressDialog;
    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        button = findViewById(R.id.button_test);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (progressDialog == null) {
                    progressDialog = new ProgressDialog(MainActivity.this);
                    progressDialog.setIndeterminate(true);
                    progressDialog.setMessage("Processing...");
                }

                progressDialog.show();
                TCPMessenger
                        .getDefaultInstance()
                        .sendCommand(new TCPMessenger.Request("192.168.1.1", "Hello"), String.class, MainActivity.this);
            }
        });


    }

    @Override
    public void onResponse(TCPMessenger.Request request, String s) {
        progressDialog.dismiss();
        Toast.makeText(this, "Response: " + s + " for request: " + request, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onError(TCPMessenger.Request request, Throwable throwable) {
        progressDialog.dismiss();
        Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show();
    }
}

Download

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

now add the dependency on your project build.gradle file

compile 'com.github.murielK:TCPMessenger:1.0.0'

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].