Restructuring + installer scripts

This commit is contained in:
Thulinma 2010-10-20 03:23:28 +02:00
parent 006da11595
commit ce6843044c
11 changed files with 34 additions and 9 deletions

18
Connector_HTTP/Makefile Normal file
View file

@ -0,0 +1,18 @@
SRC = main.cpp ../sockets/sw_base.cpp ../sockets/sw_inet.cpp ../sockets/sw_unix.cpp
OBJ = $(SRC:.cpp=.o)
OUT = Connector_HTTP
INCLUDES =
CCFLAGS = -Wall -Wextra -funsigned-char -g
CC = $(CROSS)g++
LD = $(CROSS)ld
AR = $(CROSS)ar
LIBS=
.SUFFIXES: .cpp
.PHONY: clean default
default: $(OUT)
.cpp.o:
$(CC) $(INCLUDES) $(CCFLAGS) $(LIBS) -c $< -o $@
$(OUT): $(OBJ)
$(CC) $(LIBS) -o $(OUT) $(OBJ)
clean:
rm -rf $(OBJ) $(OUT) Makefile.bak *~

27
Connector_HTTP/main.cpp Normal file
View file

@ -0,0 +1,27 @@
#include <iostream>
#include "../sockets/SocketW.h"
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <unistd.h>
#include <fcntl.h>
int main() {
SWUnixSocket mySocket;
mySocket.connect("/tmp/shared_socket");
char buffer[500000];
int msg;
std::string input;
// do something with mySocket...
while( std::cin >> input && input != "") {}
std::cout << "HTTP/1.1 200 OK\nConnection: close\nContent-Type: video/x-flv\n\n";
while(true) {
msg = mySocket.recv(&buffer[0],10000);
if (!std::cout.good()) { exit(0); }
std::cout.write(buffer,msg);
}
// disconnect
mySocket.disconnect();
return 0;
}