#include "jsocket.h" #include "jdatagramsocket.h" #include using namespace jsocket; void dump_1() { char *receive = new char[1024]; bzero(receive, 1024); try { DatagramSocket s(3200); std::istream &i = s.GetInputStream(); while (!i.eof()) { i.read(receive, 10); receive[10] = '\0'; std::cout << "char: " << receive << std::endl; } s.Close(); } catch (...) { std::cout << "error" << std::endl; } } void dump_2() { std::string receive; try { DatagramSocket s(3200); std::istream &i = s.GetInputStream(); while (!i.eof()) { i >> receive; std::cout << receive << std::flush; } s.Close(); } catch (...) { std::cout << "error" << std::endl; } } int main() { dump_2(); }