02-18-2011, 12:28 AM
c0de :
/* my network project : trial and error
author : Paulus 'C++ Mercenary' Gandung
a.k.a syn-mercs
*/
#include <iostream>
#include <cstdlib>
#include <sys\locking.h>
#define back_connect_to_master_IP 192.168.1.100
#define AF_INET
#define _WIN32
#define SOCK_STREAM
#define _CHAR_UNSIGNED
#define _ping_ system("ping 192.168.1.254 -t")
#define _telnet_ system("telnet 192.168.1.254")
typedef unsigned int _uint;
typedef unsigned char _uchar;
typedef char* _char_pointer_;
class _sock {
protected :
public :
_uint *http_port; // initializing *http_port from typedef unsigned int _uint (just use _uint)
_uint *telnet_port; // initializing *telnet_port from typedef unsigned char _uchar (just use _uchar OR type "_uchar")
_uint _command_shell;
_sock() {
*http_port = 8080;
*telnet_port = 23;
http_port = (unsigned int*) malloc(10 * sizeof(_sock) - 1);
}
~_sock() {
delete(http_port);
}
void _initiate_net_port() {
*http_port = 8080;
}
void execute_net_call() {
std::cout <<"pinging remote router......"<< std::endl;
std::cout <<'\n';
std::cout << _ping_ << std::endl;
}
void execute_remote_call() {
std::cout <<"telneting remote router......."<< std::endl;
std::cout <<'\n';
std::cout << _telnet_ << std::endl;
}
};
// main function
int main(int argc, char *argv[])
{
_sock sock;
signed int net1;
std::cout <<"enter your choice : "<< std::endl;
std::cout <<"1. pinging your router for checkable TTL"<< std::endl;
std::cout <<"2. telneting your router for bandwidth control"<< std::endl;
std::cout <<'\n';
std::cout <<"enter your choice : "<< std::endl;
std::cin >> net1;
if (net1 == 1) {
sock.execute_net_call();
} else if (net1 == 2) {
sock.execute_remote_call();
}
return 0;
/* my network project : trial and error
author : Paulus 'C++ Mercenary' Gandung
a.k.a syn-mercs
*/
#include <iostream>
#include <cstdlib>
#include <sys\locking.h>
#define back_connect_to_master_IP 192.168.1.100
#define AF_INET
#define _WIN32
#define SOCK_STREAM
#define _CHAR_UNSIGNED
#define _ping_ system("ping 192.168.1.254 -t")
#define _telnet_ system("telnet 192.168.1.254")
typedef unsigned int _uint;
typedef unsigned char _uchar;
typedef char* _char_pointer_;
class _sock {
protected :
public :
_uint *http_port; // initializing *http_port from typedef unsigned int _uint (just use _uint)
_uint *telnet_port; // initializing *telnet_port from typedef unsigned char _uchar (just use _uchar OR type "_uchar")
_uint _command_shell;
_sock() {
*http_port = 8080;
*telnet_port = 23;
http_port = (unsigned int*) malloc(10 * sizeof(_sock) - 1);
}
~_sock() {
delete(http_port);
}
void _initiate_net_port() {
*http_port = 8080;
}
void execute_net_call() {
std::cout <<"pinging remote router......"<< std::endl;
std::cout <<'\n';
std::cout << _ping_ << std::endl;
}
void execute_remote_call() {
std::cout <<"telneting remote router......."<< std::endl;
std::cout <<'\n';
std::cout << _telnet_ << std::endl;
}
};
// main function
int main(int argc, char *argv[])
{
_sock sock;
signed int net1;
std::cout <<"enter your choice : "<< std::endl;
std::cout <<"1. pinging your router for checkable TTL"<< std::endl;
std::cout <<"2. telneting your router for bandwidth control"<< std::endl;
std::cout <<'\n';
std::cout <<"enter your choice : "<< std::endl;
std::cin >> net1;
if (net1 == 1) {
sock.execute_net_call();
} else if (net1 == 2) {
sock.execute_remote_call();
}
return 0;



