Jump to content

spbr

Member
  • Posts

    114
  • Joined

  • Last visited

Awards

This user doesn't have any awards

About spbr

  • Birthday Jun 28, 1995

Profile Information

  • Gender
    Male

System

  • CPU
    i5-4690
  • GPU
    Nvidia GTX 660
  • Operating System
    Windows 7

Recent Profile Visitors

1,163 profile views
  1. Hi, Currently, I have a bash script which when the user logs in the PC connects to a VM on another computer: ECHO OFF CLS :MENU ECHO. ECHO ............................................... ECHO PRESS 1 or 2 to select your OS, or 3 to EXIT. ECHO ............................................... ECHO. ECHO 1 - Start Windows VM (port# 3390) ECHO 2 - Start Ubuntu VM (port# 3389) ECHO 3 - EXIT ECHO. SET /P M=Type 1, 2 or 3 then press ENTER: IF %M%==1 GOTO Windows IF %M%==2 GOTO Ubuntu IF %M%==3 GOTO EOF :Windows mstsc /v:192.168.0.2:3390 /f GOTO MENU :Ubuntu mstsc /v:192.168.0.2:3389 /f GOTO MENU Now what I want to add, is to be able for the PC to log off when the remote desktop program closes Thank you
  2. Thanks for that, I'm able to have LAN PC ping the WAN PC but not vice versa I've disabled the firewall on both PCs which allowed the LAN PC to ping successfully. The router I'm using is tl-r600vpn Thank you
  3. IPs: PC1: DHCP Router: LAN: 192.168.0.1/24 WAN: 10.0.0.1/24 PC2: 10.0.0.2/24
  4. Hi, Network Layout: | LAN Side | WAN Side | PC1 ---------- Switch ---------- Router ---------- PC2 I'm unable to get PC2 to ping PC1 Seems traffic is unable to transmit from WAN to LAN and vice versa Any help required Thank you
  5. Hi, I've got the below line chart How do I bring the 4 line series closer together, so there is a huge gap between them Thank you
  6. I've got the following python chat server code: import socket import threading import sys class Server: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connections = [] def __init__(self): self.sock.bind(('0.0.0.0', 10000)) self.sock.listen(1) def handler(self, c, a): while True: data = c.recv(1024) for connection in self.connections: connection.send(data) if not data: print(str(a[0]) + ':' + str(a[1]), "disconnected") self.connections.remove(c) c.close() break def run(self): while True: c, a = self.sock.accept() cThread = threading.Thread(target=slef.handler, args=(c, a)) cThread.daemon = True cThread.start() self.connections.append(c) print(str(a[0]) + ':' + str(a[1]), "connected") class Client: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def sendMsg(self): while True self.sock.send(bytes(input(""). 'utf-8')) def __init__(self, address): self.sock.connect((address, 10000)) iThread = threading.Thread(target=self.sendMsg) iThread.daemon = True iThread.start() while True data = self.sock.recv(1024) if not data: break print(str(data, 'utf-8')) if (len(sys.argv) > 1): client = Client(sys.argv[1]) else: server = Server() server.run() and I'm able to send messages across two machines, but I would like to automatically have messages sent into the python chat messaging service with a bash script. Is there any way to do this? Thank you
  7. Hi, I'm currently run into an issue with my below python code import socket import threading import sys class Server: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connections = [] def __init__(self): self.sock.bind(('0.0.0.0', 10000)) self.sock.listen(1) def handler(self, c, a): while True: data = c.recv(1024) for connection in self.connections: connection.send(data) if not data: print(str(a[0]) + ':' + str(a[1]), "disconnected") self.connections.remove(c) c.close() break def run(self): while True: c, a = self.sock.accept() cThread = threading.Thread(target=self.handler, args=(c, a)) cThread.daemon = True cThread.start() self.connections.append(c) print(str(a[0]) + ':' + str(a[1]), "connected") class Client: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def sendMsg(self): while True: self.sock.send(bytes(input(""), 'utf-8')) def __init__(self, address): self.sock.connect((address, 10000)) iThread = threading.Thread(target=self.sendMsg) iThread.daemon = True iThread.start() while True: data = self.sock.recv(1024) if not data: break print(str(data, 'utf-8')) if (len(sys.argv) > 1): client = Client(sys.argv[1]) else: server = Server() server.run() Everytime I run the code on the client end I keep getting the following error: File "chat.py", line 29 print(str(a[0]) + ':' + str(a[1]), "connected") The python code is exactly the same on the server and client end, but I don't get any issues on the server end. Any Questions? Thank you
  8. Hi, #! /bin/bash ip="172.16.0.1" networkconf="filetext.txt" dhcpd="filetext.txt" netmask30="2" netmask29="6" netmask28="14" echo "How many raspberry pi's are on your premises?" read norpi if [[ "$norpi" -le "$netmask30" ]]; then sed -i "30s/.*/netmask 255.255.255.252/" "$networkconf" sed -i.bak "10s/$/ 255.255.255.252{/" "$dhcpd" elif [[ "$norpi" -ge 3 && "$norpi" -le "$netmask29" ]]; then sed -i "30s/.*/netmask 255.255.255.248/" "$networkconf" sed -i.bak "10s/$/ 255.255.255.248{/" "$dhcpd" elif [[ "$norpi" -ge 7 && "$norpi" -le "$netmask28" ]]; then sed -i "30s/.*/netmask 255.255.255.240/" "$networkconf" sed -i.bak "10s/$/ 255.255.255.240{/" "$dhcpd" else echo "unable" fi lastoct=${ip: -1} range="$(($lastoct + $norpi))" echo "$range" So at the moment I'm able to take the last digit of the ip and add the amount of raspberry pi's, but what I want to do know is to place the new digit, from variable 'range' and replace the last digit of 'ip' with 'range'. Any Suggestions? Thank you
  9. I guess thats one way Do you think this would work? variable='cmd1;cmd2'
  10. Hi, Is there a way to group multiple commands, which then can be executed by a single variable? variable( command1 command2 ) Any Questions? Thank you
×