طلب ازا ممكن

السلام عليكم ورحمة الله وبركاتة

ازا ممكن بس بدي اطلب منكم كودات بلغة C# لعمل FTP client/server ومع الديزاين
الكامل لو سمحتوا
ويا ريت الكود يحسبلنا عدد buckets التالفة وكمان يحسبلنا نسبة الخطأ


ولكم جزيل الشكر

[CENTER][FONT=Traditional arabic][SIZE=5][COLOR=Purple][B]“مغلبة نفسك أوي كده ليه يا شيخه دنت مش طالبه حاجة
بقول لو في مجال تخديلك جهاز كمبيوتر بالمرة
و لو عايزه حد من الأعضاء يزاكر عنك المادة ما فيش مشكلة”

التعليق على سبيل المزاح و أرجو أن لا يكون ثقيلا و أتمنى أن يفيدك أحد الأعضاء

[/b][/color][/size][/font][/center]

:eh_s(5):

[quote=“اسلامية”]

السلام عليكم ورحمة الله وبركاتة

ازا ممكن بس بدي اطلب منكم كودات بلغة C# لعمل FTP client/server ومع الديزاين
الكامل لو سمحتوا
ويا ريت الكود يحسبلنا عدد buckets التالفة وكمان يحسبلنا نسبة الخطأ

[FONT=Arial Black][SIZE=5]ولكم جزيل الشكر[/size][/font] 

[/quote]

وعليكم السلام
اليك ما تريدين على مرحلتين :

اولا : A Complete FTP Server

Download executable - 45.4 Kb

Download source - 93.8 Kb

Description

This article presents a fully functional implementation of a FTP server. It can handle multiple connections at the same time (multi threaded) and has most of the features you would find in other commercial/shareware FTP servers. The server handles all basic FTP commands and offers easy user account management.

This article describes the most important classes of the application:

CFTPServer

This class is in fact the FTP server, and controls all other classes needed for the server to work. Although CFTPServer is part of a dialog based application, it does not rely on a User Interface and can easily be implemented in a service or console application as well.

[ul]
[li]BOOL Start() Activates the FTP server. It opens a listening socket (port 21) to accept connections. [/li][li]void Stop() Deactivates the server and disconnects all connected clients by terminating the running threads.[/li][li]BOOL IsActive() Is FTP server active?[/li][li]void SetMaxUsers(int nValue) Set maximum number of users.[/li][li]void SetPort(int nValue) Set listening port for new connections.[/li][li]void SetTimeout(int nValue) Set connection timeout (in ms). When a client does not send any commands for nValue ms, the server will close the connection.[/li][li]void SetWelcomeMessage(LPCTSTR lpszText) Set the text that will be displayed when the client logs on.[/li][li]void Initialize(CFTPEventSink *pEventSink) Set the event sink. The event sink will be the window (or any class) that receives the events generated by the FTP server. See CFTPEventSink description for more info.[/li][/ul]

CFTPEventSink

To be able to ‘send’ events from the CFTPServer class to the main application, I used multiple inheritance and virtual functions. The CFTPEventSink is just a helper class that contains nothing else than virtual functions, when you derive your class from CFTPEventSink these virtual functions become a kind of events. The class CFTPServer has a reference to this class and calls the virtual functions when it needs to notify the application.

The following ‘events’ are available:

[ul]
[li]void OnFTPUserConnected(DWORD nThreadID, LPCTSTR lpszUser, LPCSTR lpszAddress); A client has successfully connected.[/li][li]void OnFTPUserDisconnected(DWORD nThreadID, LPCTSTR lpszUser); A client has disconnected.[/li][li]void OnFTPStatusChange(int nType, LPCTSTR lpszText); FTP server status has changed (file downloaded/uploaded).[/li][li]void OnFTPReceivedBytesChange(int nBytes); The number of received bytes has changed.[/li][li]void OnFTPSentBytesChange(int nBytes); The number of sent bytes received has changed.[/li][li]void OnFTPStatisticChange(int nType, int nValue); A statistic has changed, for example the number of downloaded or uploaded files.[/li][/ul]

Other helper classes:

CUserManager

The class CUserManager handles all user and file related stuff. It checks the connected users for their access rights and converts remote to local paths. CUserManager uses serializing for storing and loading the user settings.

CListenSocket

This socket is part of CFTPServer and accepts incoming connections. When a clients connects to the server, CListenSocket accepts the connection and creates a new thread (CConnectThread) that will take care of all further communication between the client and the server. After the thread has been created, CListenSocket will return to its waiting state.

CConnectThread

This thread will handle all communication between the client and the server using CConnectSocket.

CConnectSocket

This socket class will process all incoming FTP commands and send back the response to the client.

CDataSocket

When data needs to be send or received, a CDataSocket will be created by CConnectSocket. The CDataSocket class will transfer this data (such as directory listings and files) on a separate port.

All the other classes are just UI related and are only included to make it look a little bit fancier.

CFTPServer Usage:

To use the class in your application, you need to do the following:

[ol]
[li]Add the class to your application.[/li][li]Derive your main class from CFTPEventSink.[/li][li]Override the virtual functions of CFTPEventSink; these are the events that come from the server.[/li][li]Initialize the eventsink.[/li][li]Start the server.[/li][/ol]

[LEFT]ثانيا :[SIZE=3]C# FTP Client Library

Download source (build the project for a demo) - 17.6 Kb

[/size][/left]
Introduction

This code is for implementing FTP client capabilities in applications without needing to know the underlying protocol. The general idea is ‘easy to use’ while giving you access to (mainly) information you would also want to know about the upload/download process. One of the things that pushed me towards writing it was a lack of pre-existing code that lets you have progress information. The DoDownload() and DoUpload() functions return the bytes received, and the total bytes and file size info are available as well for any further calculations you might want to do.

There is no screenshot of the demo application because the purpose of this code is not to provide you with a functioning application. There is a demo application though, just to demonstrate how I intended the code to be used. It’s a small command line FTP client with very basic functionality that is meant to provide a good reference on how to use the features the ftplib code provides.

Using the code

See the sample application for the best example of using it. I’ve made notes in the comments about how to use it, and there is info in the comments of ftplib.cs about adding on to it, functions you should call to keep from re-inventing the wheel, and how to deal with critical and non-critical errors.