removed socket code s
This commit is contained in:
@@ -26,7 +26,7 @@ from flask import (
|
|||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
import socket
|
# import socket
|
||||||
|
|
||||||
|
|
||||||
#import SQLAlchemy
|
#import SQLAlchemy
|
||||||
@@ -43,8 +43,8 @@ db = SQLAlchemy(app)
|
|||||||
app.config['SECRET_KEY'] = os.getenv("JWT_SECRET")
|
app.config['SECRET_KEY'] = os.getenv("JWT_SECRET")
|
||||||
#print( "aaaa-bbbb--ccccc" )
|
#print( "aaaa-bbbb--ccccc" )
|
||||||
#print( jwt_secret )
|
#print( jwt_secret )
|
||||||
SOCKET_URL = os.getenv("SOCKET_URL") # The server's hostname or IP address
|
# SOCKET_URL = os.getenv("SOCKET_URL") # The server's hostname or IP address
|
||||||
print(SOCKET_URL)
|
# print(SOCKET_URL)
|
||||||
|
|
||||||
template = {
|
template = {
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
@@ -449,51 +449,51 @@ def myproduct(current_user):
|
|||||||
|
|
||||||
# PORT = 65432 # The port used by the serv
|
# PORT = 65432 # The port used by the serv
|
||||||
|
|
||||||
@app.route("/panel/socket/send")
|
# @app.route("/panel/socket/send")
|
||||||
def socket_connect_send():
|
# def socket_connect_send():
|
||||||
print(SOCKET_URL)
|
# print(SOCKET_URL)
|
||||||
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
# client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
client_socket.connect(('10.0.0.32', 5005))
|
# client_socket.connect(('10.0.0.32', 5005))
|
||||||
print( "HERE 002:")
|
# print( "HERE 002:")
|
||||||
while 1:
|
# while 1:
|
||||||
data = client_socket.recv(512)
|
# data = client_socket.recv(512)
|
||||||
print( "HERE 003: " , data)
|
# print( "HERE 003: " , data)
|
||||||
if ( data == 'q' or data == 'Q'):
|
# if ( data == 'q' or data == 'Q'):
|
||||||
print( "HERE 001:")
|
# print( "HERE 001:")
|
||||||
client_socket.close()
|
# client_socket.close()
|
||||||
break;
|
# break;
|
||||||
else:
|
# else:
|
||||||
print( "RECIEVED:" , data)
|
# print( "RECIEVED:" , data)
|
||||||
data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
# data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
||||||
if (data != 'Q' and data != 'q'):
|
# if (data != 'Q' and data != 'q'):
|
||||||
client_socket.send(data)
|
# client_socket.send(data)
|
||||||
else:
|
|
||||||
client_socket.send(data)
|
|
||||||
client_socket.close()
|
|
||||||
break;
|
|
||||||
|
|
||||||
#
|
|
||||||
# with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
||||||
# s.connect(("10.0.0.32", 5005))
|
|
||||||
# while 1:
|
|
||||||
# data = s.recv(512)
|
|
||||||
# if ( data == 'q' or data == 'Q'):
|
|
||||||
# s.close()
|
|
||||||
# break;
|
|
||||||
# else:
|
# else:
|
||||||
# print "RECIEVED:" , data
|
# client_socket.send(data)
|
||||||
# data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
# client_socket.close()
|
||||||
# if (data <> 'Q' and data <> 'q'):
|
# break;
|
||||||
# s.send(data)
|
#
|
||||||
# else:
|
# #
|
||||||
# s.send(data)
|
# # with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
# s.close()
|
# # s.connect(("10.0.0.32", 5005))
|
||||||
# break;
|
# # while 1:
|
||||||
# # s.emit('join', 'room1');
|
# # data = s.recv(512)
|
||||||
# s.join('room1')
|
# # if ( data == 'q' or data == 'Q'):
|
||||||
# s.sendall(b"Hello, world")
|
# # s.close()
|
||||||
# data = s.recv(1024)
|
# # break;
|
||||||
# print(f"ConRes {res!r}")
|
# # else:
|
||||||
# print(f"Received {data!r}")
|
# # print "RECIEVED:" , data
|
||||||
|
# # data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
||||||
return jsonify(socket_end="socket_call")
|
# # if (data <> 'Q' and data <> 'q'):
|
||||||
|
# # s.send(data)
|
||||||
|
# # else:
|
||||||
|
# # s.send(data)
|
||||||
|
# # s.close()
|
||||||
|
# # break;
|
||||||
|
# # # s.emit('join', 'room1');
|
||||||
|
# # s.join('room1')
|
||||||
|
# # s.sendall(b"Hello, world")
|
||||||
|
# # data = s.recv(1024)
|
||||||
|
# # print(f"ConRes {res!r}")
|
||||||
|
# # print(f"Received {data!r}")
|
||||||
|
#
|
||||||
|
# return jsonify(socket_end="socket_call")
|
||||||
Reference in New Issue
Block a user