/***************************************************************************
                          KRemoteConnect.h  -  description
                             -------------------
    begin                : Tue May 2 2000
    copyright            : (C) 2000 by Martin Heni
    email                : martin@heni-online.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef _KREMOTECONNECT_H_
#define _KREMOTECONNECT_H_

//#include <ksock.h>
#include "KEMessage.h"
#include "KRSocket.h"
//#include "ksock.h"
#include "KChildConnect.h"
#include <dnssd/publicservice.h>



class KRemoteConnect: public KChildConnect
{
  TQ_OBJECT
  

  protected:
  KRServerSocket *kServerSocket;
  TDESocket *kSocket;
  TQString IP;
  TQString Name;
  ushort port;
  KR_STATUS socketStatus;
  char *buffer;
  KEMessage *bufferMsg;
  DNSSD::PublicService *service;
//  TQString inputbuffer;
//  bool input_pending;
//  TQStrList inputcache;

  public:
  KRemoteConnect();
  ~KRemoteConnect();
  bool Init(int id=0,KEMessage *msg=0);
  bool Exit();
  bool Next();
//  bool SendMsg(KEMessage *msg);
  virtual bool Send(TQString str);
//  void Receive(TQString input);
  virtual KR_STATUS QueryStatus();

  protected:
  bool OfferServerSocket();

  protected slots:
   void socketClosed(TDESocket *sock);
   void socketRead(TDESocket *sock);
   void socketWrite(TDESocket *sock);
   void socketRequest(TDESocket *sock);



  signals:
  void signalPrepareMove(KEMessage *msg,KG_INPUTTYPE type); 
//  void signalReceiveMsg(KEMessage *msg); 
};

#endif
