i'll start typing a command in the telnet module to communicate with my telnet server after i've already been connected and the server will suddenly drop me, exit telnet, and bring up the cmd prompt. what in this code is doing this?

void do_handleclient(int connsock,struct sockaddr_in *client_addr) {
  // Communicating with our new friend.
  string buffer, execmd;
  char filename[25000];
  int b=0, n=1, nstr=0, str=0;
  string sendbuf;
  char *cbuff=(char*)sendbuf.c_str();

  while(n!=0)
	  n=recv(connsock,cbuff,25000-1,0);
  while(cbuff[nstr]!=' ') { 
	  execmd[nstr]=cbuff[nstr];
	  nstr++;
  }
  while(cbuff[nstr]!='\r' || cbuff[nstr]!=' ') {
	  filename[str]=cbuff[str];
	  nstr++;
  }
  
  ifstream fd;
  fd.open(filename, ifstream::in);
  int length;
  while(1) {
      fd.read(cbuff,25000); // Reading the textfile.
	  fd.seekg(0,ios::end);
	  length=fd.tellg();
	  fd.seekg(0,ios::beg);
	  //if(length=0)               // EOF.
	  //    break;
      if(send(connsock,cbuff,length,0)==-1) 
          break;
  }
}

I can send messages on lan on local but I cann't send messages on internet on global. please help me. do you have a source of sending messages on global on internet?

anyone?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.