Connector_RAW for server sharing
This commit is contained in:
parent
2274a05b9c
commit
309f727f62
4 changed files with 61 additions and 0 deletions
18
Connector_RAW/Makefile
Normal file
18
Connector_RAW/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_RAW
|
||||||
|
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 *~
|
26
Connector_RAW/main.cpp
Normal file
26
Connector_RAW/main.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include "../sockets/SocketW.h"
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
SWUnixSocket mySocket;
|
||||||
|
std::string input;
|
||||||
|
std::cin >> input;
|
||||||
|
input = "/tmp/shared_socket_"+input;
|
||||||
|
mySocket.connect(input);
|
||||||
|
char buffer[500000];
|
||||||
|
int msg;
|
||||||
|
while(true) {
|
||||||
|
msg = mySocket.recv(&buffer[0],10000);
|
||||||
|
if (!std::cout.good()) {exit(0);}
|
||||||
|
std::cout.write(buffer,msg);
|
||||||
|
}
|
||||||
|
// disconnect
|
||||||
|
mySocket.disconnect();
|
||||||
|
return 0;
|
||||||
|
}
|
4
Makefile
4
Makefile
|
@ -3,17 +3,20 @@ default: client-local-install
|
||||||
client:
|
client:
|
||||||
cd Connector_HTTP; $(MAKE)
|
cd Connector_HTTP; $(MAKE)
|
||||||
cd Connector_RTMP; $(MAKE)
|
cd Connector_RTMP; $(MAKE)
|
||||||
|
cd Connector_RAW; $(MAKE)
|
||||||
#cd Connector_RTSP; $(MAKE)
|
#cd Connector_RTSP; $(MAKE)
|
||||||
cd Buffer; $(MAKE)
|
cd Buffer; $(MAKE)
|
||||||
client-clean:
|
client-clean:
|
||||||
cd Connector_HTTP; $(MAKE) clean
|
cd Connector_HTTP; $(MAKE) clean
|
||||||
cd Connector_RTMP; $(MAKE) clean
|
cd Connector_RTMP; $(MAKE) clean
|
||||||
|
cd Connector_RAW; $(MAKE) clean
|
||||||
#cd Connector_RTSP; $(MAKE) clean
|
#cd Connector_RTSP; $(MAKE) clean
|
||||||
cd Buffer; $(MAKE) clean
|
cd Buffer; $(MAKE) clean
|
||||||
clean: client-clean
|
clean: client-clean
|
||||||
client-install: client
|
client-install: client
|
||||||
cp -f ./Connector_HTTP/Connector_HTTP /usr/bin/
|
cp -f ./Connector_HTTP/Connector_HTTP /usr/bin/
|
||||||
cp -f ./Connector_RTMP/Connector_RTMP /usr/bin/
|
cp -f ./Connector_RTMP/Connector_RTMP /usr/bin/
|
||||||
|
cp -f ./Connector_RAW/Connector_RAW /usr/bin/
|
||||||
#cp -f ./Connector_RTSP/Connector_RTSP /usr/bin/
|
#cp -f ./Connector_RTSP/Connector_RTSP /usr/bin/
|
||||||
cp -f ./Buffer/Buffer /usr/bin/
|
cp -f ./Buffer/Buffer /usr/bin/
|
||||||
cp -f ./PLS /etc/xinetd.d/
|
cp -f ./PLS /etc/xinetd.d/
|
||||||
|
@ -22,6 +25,7 @@ client-local-install: client
|
||||||
mkdir -p ./bin
|
mkdir -p ./bin
|
||||||
cp -f ./Connector_HTTP/Connector_HTTP ./bin/
|
cp -f ./Connector_HTTP/Connector_HTTP ./bin/
|
||||||
cp -f ./Connector_RTMP/Connector_RTMP ./bin/
|
cp -f ./Connector_RTMP/Connector_RTMP ./bin/
|
||||||
|
cp -f ./Connector_RTMP/Connector_RAW ./bin/
|
||||||
#cp -f ./Connector_RTSP/Connector_RTSP ./bin/
|
#cp -f ./Connector_RTSP/Connector_RTSP ./bin/
|
||||||
cp -f ./Buffer/Buffer ./bin/
|
cp -f ./Buffer/Buffer ./bin/
|
||||||
|
|
||||||
|
|
13
PLS
13
PLS
|
@ -21,3 +21,16 @@ service ddvtechrtmp
|
||||||
port = 1935
|
port = 1935
|
||||||
wait = no
|
wait = no
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service ddvtechraw
|
||||||
|
{
|
||||||
|
disable = no
|
||||||
|
type = UNLISTED
|
||||||
|
protocol = tcp
|
||||||
|
socket_type = stream
|
||||||
|
user = root
|
||||||
|
server = /usr/bin/Connector_RAW
|
||||||
|
port = 3773
|
||||||
|
wait = no
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue