removed socket code s
This commit is contained in:
@@ -26,7 +26,7 @@ from flask import (
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
import socket
|
||||
# import socket
|
||||
|
||||
|
||||
#import SQLAlchemy
|
||||
@@ -43,8 +43,8 @@ db = SQLAlchemy(app)
|
||||
app.config['SECRET_KEY'] = os.getenv("JWT_SECRET")
|
||||
#print( "aaaa-bbbb--ccccc" )
|
||||
#print( jwt_secret )
|
||||
SOCKET_URL = os.getenv("SOCKET_URL") # The server's hostname or IP address
|
||||
print(SOCKET_URL)
|
||||
# SOCKET_URL = os.getenv("SOCKET_URL") # The server's hostname or IP address
|
||||
# print(SOCKET_URL)
|
||||
|
||||
template = {
|
||||
"swagger": "2.0",
|
||||
@@ -449,51 +449,51 @@ def myproduct(current_user):
|
||||
|
||||
# PORT = 65432 # The port used by the serv
|
||||
|
||||
@app.route("/panel/socket/send")
|
||||
def socket_connect_send():
|
||||
print(SOCKET_URL)
|
||||
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
client_socket.connect(('10.0.0.32', 5005))
|
||||
print( "HERE 002:")
|
||||
while 1:
|
||||
data = client_socket.recv(512)
|
||||
print( "HERE 003: " , data)
|
||||
if ( data == 'q' or data == 'Q'):
|
||||
print( "HERE 001:")
|
||||
client_socket.close()
|
||||
break;
|
||||
else:
|
||||
print( "RECIEVED:" , data)
|
||||
data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
||||
if (data != 'Q' and data != 'q'):
|
||||
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;
|
||||
# @app.route("/panel/socket/send")
|
||||
# def socket_connect_send():
|
||||
# print(SOCKET_URL)
|
||||
# client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
# client_socket.connect(('10.0.0.32', 5005))
|
||||
# print( "HERE 002:")
|
||||
# while 1:
|
||||
# data = client_socket.recv(512)
|
||||
# print( "HERE 003: " , data)
|
||||
# if ( data == 'q' or data == 'Q'):
|
||||
# print( "HERE 001:")
|
||||
# client_socket.close()
|
||||
# break;
|
||||
# else:
|
||||
# print( "RECIEVED:" , data)
|
||||
# data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
||||
# if (data != 'Q' and data != 'q'):
|
||||
# client_socket.send(data)
|
||||
# else:
|
||||
# print "RECIEVED:" , data
|
||||
# data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
||||
# 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")
|
||||
# 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:
|
||||
# # print "RECIEVED:" , data
|
||||
# # data = raw_input ( "SEND( TYPE q or Q to Quit):" )
|
||||
# # 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