6 #include <sys/socket.h> 7 #include <netinet/in.h> 12 typedef int socklen_t;
22 printf(
"zeroing...\n");
24 printf(
"zeroing done..\n");
26 sock = socket(AF_INET, SOCK_STREAM, 0);
27 printf(
"create socket..\n");
30 printf(
"no socket...\n");
34 myaddr.sin_family = AF_INET;
35 myaddr.sin_port = htons(localport);
45 printf(
"setting socket opts reuse...\n");
46 if (setsockopt(
sock, SOL_SOCKET, SO_REUSEADDR, (
char *)&blen,
sizeof(blen)) < 0)
51 printf(
"binding...\n");
57 perror(
"bind failed");
77 printf(
"deleting DTCtcp\n");
79 shutdown(
sock, SHUT_RDWR);
90 unsigned long maddr =
clientAddr.sin_addr.s_addr;
97 return shutdown(
sock, SHUT_RDWR);
105 if (listen(
sock, 2) < 0) {
106 perror(
"listen failed");
114 perror(
"accept failed");
118 return new DTCtcp(snew, 0);
127 perror(
"connect failed");
139 perror(
"connect failed");
152 int readnow = recv(
sock, &
buffer[howmany], toberead, 0);
155 printf(
"some rrorrs...%d\n", errno);
161 }
while (toberead > 0);
int Receive(char *buffer, int size)
int Send(char *buffer, int size)
struct sockaddr_in myaddr
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
void Connect(const char *hostaddr, int port)
struct sockaddr_in clientAddr