Project 1999

Go Back   Project 1999 > General Community > Technical Discussion

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 07-13-2020, 10:45 PM
Consty Consty is offline
Large Rat


Join Date: Nov 2014
Posts: 5
Default Updated script

Updated script to work with python 2/3 (previous script had inconsistent whitespace) and now the script can be terminated by pressing CTRL+C. Hope this helps you folks out there running Everquest on Linux using wine. [You must be logged in to view images. Log in or Register.]

Code:
#!/usr/bin/env python
import socket
import threading
import time
import os
import signal

FROM_IP = "127.0.0.1"
FROM_PORT = 5998
REPLY_IP = ""
REPLY_PORT = 0
TO_IP = "login.eqemulator.net"
TO_PORT = 5998

from_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
from_sock.bind((FROM_IP, FROM_PORT))
to_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
to_sock.bind(('', 0))

def local():
        global REPLY_IP, REPLY_PORT
        while True:
                data, addr = from_sock.recvfrom(4096)
                REPLY_IP, REPLY_PORT = addr
                to_sock.sendto(data, (TO_IP, TO_PORT))
                print("Sending " + str(len(data)) + " bytes to " + TO_IP + ":" + str(TO_PORT))

def remote():
        global REPLY_IP, REPLY_PORT
        while True:
                data, addr = to_sock.recvfrom(4096)
                from_sock.sendto(data, (REPLY_IP, REPLY_PORT))
                print("Sending " + str(len(data)) + " bytes to " + REPLY_IP + ":" + str(REPLY_PORT))

print("Waiting for data on " + FROM_IP + ":" + str(FROM_PORT) + "...")
threading.Thread(target=local, args=()).start()
threading.Thread(target=remote, args=()).start()

try:
        while True:
                time.sleep(1)
                pass
except KeyboardInterrupt:
	os.kill(os.getpid(), signal.SIGTERM)
Last edited by Consty; 07-13-2020 at 10:50 PM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:15 PM.


Everquest is a registered trademark of Daybreak Game Company LLC.
Project 1999 is not associated or affiliated in any way with Daybreak Game Company LLC.
Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.