Restructuring + installer scripts
This commit is contained in:
parent
006da11595
commit
ce6843044c
11 changed files with 34 additions and 9 deletions
18
Connector_HTTP/Makefile
Normal file
18
Connector_HTTP/Makefile
Normal 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
27
Connector_HTTP/main.cpp
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue