Python Server/Client Application Development

Hey All!
I am writing a basic proof of concept server/client application for a project I am working on.
My goal is this:
1) End user launches client.
2) Client connects to server.
3) User selects one or more files to send to server.
4) Server saves a copy of each file.
5) Server terminates connection.
5) Server processes each file.
6) Upon completion of the processing server sets a "processing completed flag."
7) Client periodically checks with server for "processing completed flag."
8) Client securely reconnects
9) Client downloads processed files.
I have no background in programming servers/clients so this will be a learning experience for me and the workflow described above may change as I learn more about how this all works. Currently my hope is to first implement a system that will stay connected while the files are processed and once I have a better understanding as to how that works I can add more complexity to the system.
I will be writing this in Python 3.3 and the server will be hosted on a server which will (for now) be running Arch.
This thread will act as a sort of development journal but feel free to comment or post suggestions. I will for sure have questions as I go along too!

brettski wrote:Turns out the best way (so far as I can tell) is to go integer -> string -> byte and then byte -> string -> integer..
Do you mean regular, non-byte strings? That cannot possibly be the best way to do it. It would be like using Russian as an intermediary language for translating Spanish to French.
Maybe the following will set you on the right path:
http://stackoverflow.com/questions/6187 … -in-python
http://stackoverflow.com/questions/4445 … int-python
Looking further, this is probably the right way to do it:
some_int = 57
bytes = struct.pack('i', bytes)
sock.send(bytes)
See http://docs.python.org/3/library/struct.html for details.
As for threaded servers, you may find some useful examples here.

Similar Messages

  • Server/client application

    i'm just starting to learn about server/client applications and i'm a little confused about actually implementing them.
    my client will be an applet which can be accessed over the internet. i want the applet to be able to read/write to the server.
    now my question is, how can i start up the server program?
    i would want it to initialize and run, only when the user has gone to the website that uses the applet.

    look at using a Servlet, running under Tomcat (download the Java Web Services Developer pack from java.sun.com
    here's what the servlet looks like:
    mport javax.servlet.*;
    import java.util.*;
    import java.net.*;
    public class ServletTest extends GenericServlet
    /** servlet is initialising */
    public void init()
    System.out.println("ServletTest initializing");
    /** servlet wascalled bt client */
    public void service(ServletRequest request,ServletResponse response)
    try
    byte[] data=new byte[100];
    ServletInputStream inputStream=request.getInputStream();
    int read=inputStream.read(data);
    String string=URLDecoder.decode(new String(data,0,read),"UTF-8");
    System.out.println("read "+read+" bytes: "+string);
    inputStream.close();
    ServletOutputStream outputStream=response.getOutputStream();
    Date date=new Date();
    outputStream.write(date.toString().getBytes());
    outputStream.close();
    catch(Exception ex)
    ex.printStackTrace();
    /** servlet is being destroyed */
    public void destroy()
    System.out.println("ServletTest terminating");
    here's what the client looks like:
    mport javax.servlet.*;
    import java.util.*;
    import java.net.*;
    public class ServletTest extends GenericServlet
    /** servlet is initialising */
    public void init()
    System.out.println("ServletTest initializing");
    /** servlet wascalled bt client */
    public void service(ServletRequest request,ServletResponse response)
    try
    byte[] data=new byte[100];
    ServletInputStream inputStream=request.getInputStream();
    int read=inputStream.read(data);
    String string=URLDecoder.decode(new String(data,0,read),"UTF-8");
    System.out.println("read "+read+" bytes: "+string);
    inputStream.close();
    ServletOutputStream outputStream=response.getOutputStream();
    Date date=new Date();
    outputStream.write(date.toString().getBytes());
    outputStream.close();
    catch(Exception ex)
    ex.printStackTrace();
    /** servlet is being destroyed */
    public void destroy()
    System.out.println("ServletTest terminating");

  • OIM Client application development using OIM API, when user password is not available

    I am developing a cleint application for OIM. The client application is a set of services, running on a separate server from where OIM is running.
    The OIM version used is 11gR2.
    As I look into the oimClient object, the login method takes username and password. As my application is in an SSO environment, I do not have the password for the user, and just have the user's login ID.
    If I am correct, the tcUtilityFactory allowed a digital signature option, to support scenarios like the above.
    Question is, does oimClient support similar functionality? I did not find any examples in the Oracle documentation.
    I will appreciate if someone can confirm a similar usage and provide me some sample code and configuration details.
    Thanks.
    -subrata

    Check: http://www.ateam-oracle.com/authenticating-oim-apis-without-end-users-password/
    -Bikash

  • Does a sql server client application needs to be modified to allow it to have benefits of running on a SQL Server 2012 cluster?

    I have a client application in c++ which interacts with sql server database. My question is whether I need to make any changes to the client application code to allow it to have the benefits of running on a SQL server 2012 cluster environment. 
    To elaborate more on my query my concern is for e.g if my application has called an api to execute a sql query and during
    the execution of this query the sql server (part of the cluster) goes down then as per my understanding the sql cluster would ensure that another node takes up the task from the current sql server which has gone down. Is this transition transparent to the
    client application or in such a case my client application needs to again make a new connection and again execute the query?

    Hello,
    Just as Shanky post above, When you connected to a database in an availability group and specify the availability group listener in the connection string, if the availability group fails over, the original connection is broken, your application
    should try a new connection after the failover.
    So, when connect to an availability group, please try to increasing connection timeout and implementing connection retry logic to increase the probability of successful connection.
    Reference:SqlClient Support for High Availability, Disaster Recovery
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here.
    Fanny Liu
    TechNet Community Support

  • Forwarding messages server -- clients

    hey guys im still having trouble with my server/client application. I have created a TCP connection orientated client/server application which allows multiple clients to be connected to the one server. my problem is, is that i want the server to "forward" the messages recieved by one client to all the others and i am having trouble doing this.. would a hashtable be my best option?!?!?
    Thanking you guys in advance.. dave-o

    I have your same problem.
    One solution I though was to keep track of the number of clients and then fordward to all of them except to the one which send the data.
    Would be nice if some one give us more ideas.

  • TELNET Server-Client Error

    I have created a server-client application wherein my client sends a text file to the server. Both the server & client applications are configured using the TELNET VI's. When the Server end is connected to the internet through a dial-up connection & client is connected through either dial-up or through any broad-band service(static IP) data exchange takes place.
    But if I connect the Server end to the internet through any broad-band connection it shows error 56. Have set time-out as -1, so i think time-out should'nt be a problem.
    Is it that listeners created in the Server application are built only to receive data from a dial-up connection & not through any broad-band connection.
    Jalpa

    Is there a reason you are using Telnet. There are example that ship with LV that show communications using a TCP connection. When communicating between two instances of LV you might also want to consider VI Server and a communications mechanism.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Using Team Foundation Server 2013 for Embedded windows application development

    Can I use Team Foundation Server 2013 to develop an application for an Embedded Board with WEC7 or WEC2013? Does it have all the features of the ultimate edition? For example, can I debug the application when it is running on the embedded board?

    Hi Davidlsar,
    If the source code of your project is created and managed by Visual Studio or Eclipse, then you can work with TFS 2013 since you can connect to team project in TFS via Team Explorer and then do the management. If you want to develop an application with a
    client machine which OS is WEC2013, you have to confirm whether you can install Visual Studio and use corresponding features on WEC2013.
    For the debugging problem, you might open a new thread in embedded forums for a better response. Thanks for your understanding.
    Best regards, 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Difference on developing client applications on PC and Mac platform.

    Hi,
    I would like to know wats the difference on developing client applications on PC and Mac platform.
    If i were to create software applications using Javascript, MS SQL Server 2000 and JAVA on Mac platform, would there be any difference from those we created on PC(Windows)?

    Write once, debug ewerywhere. There should not be any
    difference running pure Java code on difference
    platforms.Umm.. "should" is the operative word..
    Threads come to mind...as even when they are written as "Pure Java".. the native thread implementation can work harry cary (as opposed to Harry Potter) on your app...

  • Authentication in Client/Server form Application

    Hi
    My client/server application is not using oracle authentiacation, I have maintained user table from that user is authenticated, but any user logins in a application it uses same oracle username/PWD which I currently hardcoded in a forms 6i (C/S type on logon event) application.
    My client is located in different geographicaly location, when I change oracle database password I need to compile client application and diployed it again.
    Is there any way that I can avoid this. I don't want to give database Un/Pwd to any client user. He only have application username and password.
    Thanks
    Sudarshan

    Hello,
    While installing developer you can select components to
    Install, Options listed are Forms runtime and Reports runtime.
    and it will make your work done.
    Adi

  • Developing server-side applications using dreamweaver

    We are having issues developing server-side applications using dreamweaver for our client's website www.uuee.org.. They are building oracle database driven worldwide directory for Egyptian expatriates. Any help is highly appreciated.

    You made 3 statements. What is the question?  What do you need help with?

  • Search Server 2010 Express: Open a PDF document from list of search results invokes adobe reader client application with error

    Hi community,
    I set up search server 2010 express on a windows 2008 r2 server.
    The Adobe PDF iFilter 9 64 bit is installed and search is correctly configured to find PDF-files.
    When doing a search and clicking on a link of the result page, the PDF is not opened in the browser, instead the adobe reader XI client application (11.0.04) is invoked and an error raised like "could not open document .. check syntax of url..."
    Right click on a link to open in new tab works fine. And PDF-Files from other arbitrary Internet Sites opens in browser correctly. Moreover when configure Adobe Acrobat Pro 9 as default application on the client it also open in Browser correctly.
    I noticed googling the web there are several challenges when dealing with PDF-files in sharepoint. The following settings are made so far:
    1. In IE: Add-On to open PDF in Browser is enabled for all sites.
    2. Client Integration is enabled
    3. The OpenControl attribute in the DOCICON.xml is left empty OpenControl="" for the pdf entry.
    4. The Browser File Handling is set to "Permissive".
    Please feel free to ask for more information if needed.
    I appreciate any help on this. I don't know what to do further.
    Thanks in advance.

    Thanks for the reply.
    Before responding to your points I want to give a little more context:
    We have an intranet based on pure html and a little aspx containing many of those pdf- files. By clicking on the links in the intranet the files open correctly in browser handled by the adobe plugin. Now we set up this search server crawling the file system
    accessed through a share to the root folder of the intranet. In the search server settings a host mapping rule is applied to replace the file://[share] with http://[intranet host+domain+port] to access files over http.
    And now to answer your question. The resulting urls are the same, copying the link from intranet and copying the link from the search result (except some case issues).
    The event viewer not seem to show any errors on this, though I'm not very familiar using it.
    If any further information are from interest and any ideas come to your mind - please let me know.
    Thanks.

  • Best practice for client-server(Socket) application

    I want to build a client-server application
    1) On startup.. client creates connection to Server and keeps reading data from server
    2) Server keeps on sending different messages
    3) Based on messages(Async) from server client view has to be changed
    I tried different cases ended up facing IllegalStateChangeException while updating GUI
    So what is the best way to do this?
    Please give a working example .
    Thanks,
    Vijay
    Edited by: 844427 on Jan 12, 2012 12:15 AM
    Edited by: 844427 on Jan 12, 2012 12:16 AM

    Hi EJP,
    Thanks for the suggestion ,
    Here is sample code :
    public class Lobby implements LobbyModelsChangeListener{
        Stage stage;
        ListView<String> listView;
        ObservableList ol;
         public Lobby(Stage primaryStage) {
            stage = primaryStage;
               ProxyServer.startReadFromServer();//Connects to Socket Server
             ProxyServer.addLobbyModelChangeListener(this);//So that any data from server is fetched to Lobby
            init();
        private void init() {
              ProxyServer.getLobbyList();//Send
            ol = FXCollections.observableArrayList(
              "Loading Data..."
            ol.addListener(new ListChangeListener(){
                @Override
                public void onChanged(Change change) {
                    listView.setItems(ol);
         Group root = new Group();
        stage.setScene(new Scene(root));
         listView = new ListView<String>();
        listView.maxWidth(stage.getWidth());
         listView.setItems(ol);
         listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
        istView.setOnMouseClicked(new EventHandler<MouseEvent>(){
                @Override
                public void handle(MouseEvent t) {
    //                ListView lv = (ListView) t.getSource();
                    new NewPage(stage);
         root.getChildren().add(listView);
         @Override
        public void updateLobby(LobbyListModel[] changes) {
    //        listView.getItems().clear();
            String[] ar = new String[changes.length];
            for(int i=0;i<changes.length;i++)
                if(changes!=null)
    System.out.println(changes[i].getName());
    ar[i] = changes[i].getName();
    ol.addAll(ar);
    ProxyServer.javaProxyServer
    //Implements runnable
    public void run()
         ......//code to read data from server
    //make array of LobbyListModel[] ltm based on data from server
         fireLobbyModelChangeEvent(ltm);
    void addLobbyModelChangeListener(LobbyModelsChangeListener aThis) {
    this.lobbyModelsChangeListener = aThis;
         private void fireLobbyModelChangeEvent(LobbyListModel[] changes) {
    LobbyModelsChangeListener listner
    = (LobbyModelsChangeListener) lobbyModelsChangeListener;
    listner.updateLobby(changes);
    Exception :
    java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-5
             at line         ol.addAll(ar);
    But ListView is getting updated with new data...so not sure if its right way to proceed...
    Thanks,
    Vijay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Client-server database application...

    Hi there!
    I'm about to write a database-application and I wonder if the following approach is to prefer or not:
    I want to use a MySQL-database and there shall be about eight client-applications which all shall be able to use it. I think of solving the above with RMI (I want to create/deploy a server wich will contain all the different SQL-queries on the same site as where I install the MySQL-database ). From the clients I just, with RMI, invoce the methods on the server which contains the different queries I want to use. In other words all the database-functionality is located on the server somewhat like stored procedures. To make it work each client must be assigned a thread of its own on the server...is this right?
    The advantages of the above which I can think of is: I just need to stuff one J/Connector driver in the JRE (on the server). Another is that I can use the nameservice of RMI... are there others?
    Is the above a good / usual or even bad approach?
    Is it more usual or even better to just provide the database-functionality (SQL-queries) in the clients and provide every client with the J/Connector driver?
    Thanks in advance!

    You noted that there will be "eight client-applications" - does that refer to eight users or eight programs using the database? This is important in determining your course of action.
    If you're talking about a small number of concurrent users (you have to define small), then you'll probably better off trying to do all the data/business logic in the app. If you're talking about a large number of concurrent users (again, your definition), your client/server paradigm might be better.
    To complicate things, unless you're doing this as a learning-on-your-own project (e.g. not getting paid for it), this is where you might want to evaluate using J2EE technoligies for your server-side implementation. Writing your own server is not a trivial task (been there, done that - pre-J2EE, of course): there's a lot of things you have to figure out how to handle. Well, that's true of even using J2EE, but there's some portion of what your server would need to do already taken care of in an application server.

  • Client application freezes permanently when one user logoff and another user take that session on windows server 2008 r2

    Hi,
    we have windows server 2008 r2 and In our application there are three server and on e client application.
    My client application freezes on a specific scenario.
    Steps taken to hang are following:-
    1. start client application
    2. open an module named by XYZ
    3. login to remote machine with another session./ Another user login from their computer.
    4. connect with the session which have client application opened.
    5. Whenever the session is forcibly taken client application becomes unresponsive.

    Hello,
    The Windows Desktop Perfmon and Diagnostic tools forum is to discuss performance monitor (perfmon), resource monitor (resmon), and task manager, focusing on HOW-TO, Errors/Problems, and usage scenarios.
    Since your post is off-topic, I am moving it to the
    off topic forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Purpose of Multiple Clients in Development Server

    can anybody tell me the advantages and
    disadvantages of having multiple clients in a
    development server?

    I don't think there is disadvantage when we have multiple clients for development system
    DEV  SAP system may have multiple clients..
    Main pupose : Changes can be client dependent or client independent
                          Client-independent effects some clients.
                          Client-dependent effects all clients.
    Let me say one example : Dev system has two clients
    100 - Here we can write the code
    200 - Testing will be here ( customizing will done here)
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/933d3c3a926614e10000000a11402f/frameset.htm
    http://www.sap-img.com/general/what-is-sap--landscape.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/96/8a99386185c064e10000009b38f8cf/content.htm
    Thanks
    Seshu

Maybe you are looking for

  • HP Pavilion g6-2210us Notebook PC windows 8 failure. Anyone have any ideas on how to recover it?

    I recently bought a Pavilion g6, got it in the mail, it worked perfectly. However, one day when I turned it on, it started to do its rounds of automatic updates. After about 10 minutes, though, our internet gave out and it stopped updating. Then, aft

  • Would like to get iSight, iChat and Universal Access to work together

    Problem: family member with age-related macular degeneration, form not presently curable. Avid reader, feels isolated unable to do so. Due to age and related problems he's very confused trying to use Universal Access (UA) on ANY size Mac screen, situ

  • I would like to encrypt a PDF document

    Hello,      A problem came across my mind and I would to know if there is any solution. First of all I would like to know if there is any posibility for making a document mainly a pdf file unshareable, I don't point at copying the text from the docum

  • How to fix a disabled ipad

    my daughters new ipad is disabled. how do i fix this?

  • MacBook and Wireless

    While wireless is now a necessity for me, I have to say I am disappointed in the MacBook's performance. My friends with iBooks are able to get WiFi quickly and their connections are reliable. My newer MacBook, however is inconsistent in the extreme a