install.fairie/dotfiles/.vim/plugged/ale/test/script/dumb_tcp_client.py
Git E2E Dev Test Username e149692cc9 git subrepo clone https://github.com/dense-analysis/ale.git ./dotfiles/.vim/plugged/ale
subrepo:
  subdir:   "dotfiles/.vim/plugged/ale"
  merged:   "e4b205440"
upstream:
  origin:   "https://github.com/dense-analysis/ale.git"
  branch:   "master"
  commit:   "e4b205440"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:09 -04:00

33 lines
777 B
Python

"""
This is just a script for testing that the dumb TCP server actually works
correctly, for verifying that problems with tests are in Vim. Pass the
same port number given to the test server to check that it's working.
"""
import socket
import sys
def main():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex(('127.0.0.1', int(sys.argv[1])))
if result:
sock.close()
sys.exit("Couldn't connect to the socket!")
data_sent = 'x' * 1024
sock.send(data_sent)
data_received = sock.recv(1024)
if data_sent != data_received:
sock.close()
sys.exit("Data sent didn't match data received.")
sock.close()
print("Everything was just fine.")
if __name__ == "__main__":
main()