Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-15-2006
EmmanuelOga EmmanuelOga is offline
Registered User
 
 
Join Date: Jul 2006
Posts: 6
File transfer and threading.

Hello! i'm currently working on implementing a servlet that let's me take files from him. I need to be able to send the file from the servlet in a second thread, because if two clients ask me for differents files i want to be able to procces incoming messages while uploading the file. Will this interface suit my need? What else should i take in mind when implementing this?

Thank you!

Code:
sequence<byte> ByteSeq;
    
interface FileProvider
{
   // To read a buffer from a provider file
   ["ami"] nonmutating ByteSeq getFile(string path, int pos, int num);
}
__________________
Emmanuel Oga
Q4 Technologies Argentina (www.q4tech.com)
Q4Social Network (Internal lan messenger/file transfer app)
Reply With Quote
  #2 (permalink)  
Old 08-15-2006
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
Yes, I think this interface will work fine. What concerns do you exactly have?
Reply With Quote
  #3 (permalink)  
Old 08-15-2006
EmmanuelOga EmmanuelOga is offline
Registered User
 
 
Join Date: Jul 2006
Posts: 6
In fact having read the documentation again, i think waht i need is amd... but i'm worry about don't getting the right meaning for each term (amd, ami).

What i need is a responsible GUI while i transfer file from my servlet, and i need to be able to respond to other method calls while transfering the file too.

My application scheme is like this:

Code:
module Q4MusicServer
{
    sequence <Q4MusicClient::Mp3Client*> ClientList;
    
    interface Mp3Server
    {
        // Add a client to the queue
	idempotent void RegisterClient(Q4MusicClient::Mp3Client* c, out bool bSuccess);
	    
	// Remove a client from the queue
	idempotent void UnregisterClient(Q4MusicClient::Mp3Client* c);
        
        // Send a message to a client.
        nonmutating SendMessage(string message);
	};
};
This "music server" is on the only machine that have speakers on my office, so a number of clients is going to register to this server to request his music is played. The server register all clients and then, one by one, request the files from every client. The client interface is like is:

Code:
module Q4MusicClient
{
    sequence<byte> ByteSeq;
    
	interface Mp3Client
	{
            nonmutating bool HasFile(string fileName);
        
	    ["ami"] nonmutating ByteSeq getFile(string path, int pos, int num);
        
            // Gets the name of the mp3 that the client want to play
            nonmutating string GetCurrentMp3Name();

            nonmutating SendMessage(string message);
       
            // if the server is shut-down, first it tries to disconnect the clients
            idempotent void Disconnect();
	};
};
In my server the mp3 player runs on his own thread, and i can set a callback to the mp3 filereader, so i'm not concerned about blocking on the server. The file read callback, in fact, should wait the response of the client method getFile, similar to what happen when you read a file from the disk

In the client, in the other side, i need to procces the response to the getFile and, maybe, at the same time, respond to other methods (like server sending me a message using SendMessage), and i need to keep the GUI responsive too. For this reasons, i think i should use AMD on the Mp3Client instead of AMI. What do you think???

Thank you very much!
__________________
Emmanuel Oga
Q4 Technologies Argentina (www.q4tech.com)
Q4Social Network (Internal lan messenger/file transfer app)
Reply With Quote
  #4 (permalink)  
Old 08-15-2006
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
I'm afraid your questions go beyond the free support we can offer here in these forums. In essence, you are asking for help with the design of your particular application. We can offer this as consulting services to your company. If you are interested, please contact us at info@zeroc.com.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Program implementation / File Transfer Questions (yes, i have read the faq :) )/ Ruby EmmanuelOga Help Center 2 08-01-2006 06:58 PM
Any Example that do file transfer out there alexm Help Center 2 04-06-2006 06:31 PM
How can I develop a File transfer application?question 1 xiehua Help Center 11 12-05-2003 11:39 PM
How can I develop a File transfer application?question 2.1 xiehua Help Center 2 11-21-2003 08:46 AM
How can I develop a File transfer application?question 2 xiehua Help Center 4 11-20-2003 11:33 AM


All times are GMT -4. The time now is 05:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.