/*
 * tcp_client.h
 *
 *  Created on: 2022年10月5日
 *      Author: Allen
 */

#ifndef JNI_NET_TCP_CLIENT_H_
#define JNI_NET_TCP_CLIENT_H_

#include <atomic>
#include <functional>
#include <thread>
#include "net.h"
#include "service/BusinessConfig.h"
#include "tcp_model.h"

class TcpClient {
public:
  virtual ~TcpClient();
  static TcpClient* instance();

  void startTcp();
  void sendMsg(const char* msg);

  static bool connected();
  static bool busy();
private:
  TcpClient();
  void internalSendMsg(const char* msg);
private:
  std::atomic<bool> busy_;
};

#endif /* JNI_NET_TCP_CLIENT_H_ */
