Find Jobs
Hire Freelancers

convert python to c/c++

$30-99 USD

Cancelled
Posted almost 13 years ago

$30-99 USD

Paid on delivery
i have a python code i need it in c/c++ with feu improovement a) if it disconnects out of ane reason the program should try to connect again b) the program should be able to send computer name, internal IP and a string stored in the 10 first places of text file in specified location(if no file - send string "no zzz file" thats all ## Deliverables here is the source in python from server import * import select import sys import os import ConfigParser import time reconnect_interval = 30 echo_interval = 30 echo_timeout = echo_interval * 2 + 10 def log(text): print text def start(): path = [login to view URL]([login to view URL]([login to view URL]), '[login to view URL]') config = [login to view URL]() [login to view URL](path) # getfloat() raises an exception if the value is not a float # getint() and getboolean() also do this for their respective types server = ([login to view URL]('server', 'host'), [login to view URL]('server', 'port')) username = [login to view URL]('login', 'username') password = [login to view URL]('login', 'password') log("Config OK...") while True: try: [login to view URL](reconnect_interval) log("reconnecting...") sock = [login to view URL](socket.AF_INET, socket.SOCK_STREAM) [login to view URL](server) [login to view URL]([login to view URL]("I", 1)) assert([login to view URL](4) == [login to view URL]("I", [login to view URL])) [login to view URL]([login to view URL]("32s32s", username, password)) assert([login to view URL](4) == [login to view URL]("I", [login to view URL])) [login to view URL]([login to view URL]("I", 1)) assert([login to view URL](4) == [login to view URL]("I", [login to view URL])) log("Connected to server") while True: msg = "" (r, w, e) = [login to view URL]([sock], [], [sock], echo_timeout) if not r: raise Exception("Connection was closed by peer") msg = [login to view URL](4) if msg == [login to view URL]("I", [login to view URL]): [login to view URL](msg) else: (port,) = [login to view URL]("I", msg) print "port: %d" % port sockets = [0, 0] acceptors = [False, False] try: sockets[0] = [login to view URL](socket.AF_INET, socket.SOCK_STREAM) sockets[0].connect((localhost, port)) except Exception: print "Problem" [login to view URL]([login to view URL]("I", [login to view URL])) continue [login to view URL]([login to view URL]("I", [login to view URL])) (sport,) = [login to view URL]("I", [login to view URL](4)) print "SPort:%d" % sport sockets[1] = [login to view URL](socket.AF_INET, socket.SOCK_STREAM) sockets[1].connect((server[0], sport)) tunneler = Tunneler(sockets, acceptors) except Exception as e: log(str(e)) try: [login to view URL](socket.SHUT_RDWR) except Exception: pass while True: try: start() except Exception as e: log(str(e)) ------------------
Project ID: 3310451

About the project

Remote project
Active 13 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of ISRAEL
HAIFA, Israel
5.0
80
Payment method verified
Member since May 14, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.