<commit_before>// $Id: Socket_test.C,v 1.3 1999/11/24 14:54:25 oliver Exp $
#include <BALL/CONCEPT/classTest.h>

///////////////////////////
#include <BALL/SYSTEM/socket.h>
///////////////////////////

START_TEST(Socket, "$Id: Socket_test.C,v 1.3 1999/11/24 14:54:25 oliver Exp $")
using namespace BALL;

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST<commit_msg>added: first test - transparent transmission if one character between   two forked processes<commit_after>// $Id: Socket_test.C,v 1.4 2000/01/14 20:34:48 oliver Exp $
#include <BALL/CONCEPT/classTest.h>

///////////////////////////
#include <BALL/SYSTEM/socket.h>
#include <unistd.h>
///////////////////////////

START_TEST(Socket, "$Id: Socket_test.C,v 1.4 2000/01/14 20:34:48 oliver Exp $")
using namespace BALL;


/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////


CHECK(simple socket transmission)
SockInetBuf sock_inet_buf(SocketBuf::sock_stream);
sock_inet_buf.bind();
char c;
int port = sock_inet_buf.localport();
STATUS("localport = " << sock_inet_buf.localport())
STATUS("localhost = " << sock_inet_buf.localhost())
if (fork())
{	
	STATUS("A:listen...")
  sock_inet_buf.listen();
	STATUS("A:accept...")
  IOStreamSocket  s(sock_inet_buf.accept());
	STATUS("A:get...")
	s.get(c);
	STATUS("S:done")
} else {
	sleep(1);
	IOStreamSocket  sio(SocketBuf::sock_stream);
	int result = sio->connect(sock_inet_buf.localhost(), port);
	STATUS("B:connect = " << result)
	sio.put((char)123);
	STATUS("B:done.")
	return 0;
}
TEST_EQUAL((int)c, (int)123);
RESULT
	

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST
{'fraction_non_alphanumeric': 0.4237899073120494, 'fraction_numerical': 0.037075180226570546, 'mean_word_length': 1.3724053724053724, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1847340', 'n_tokens_mistral': 597, 'n_tokens_neox': 540, 'n_words': 102}