C# networking help

Hi everybody...

i just wanna your help with a piece of code....

client/server program, that the client wanna log in on a server ( send a username and a password) and the server verify if the username and the password match.

if they math, the server sends to the client that the usernaem and password are correct. else, it sends that they are not correct.

the suernames and passwords pairs are stored in an array or in a Hashtable in the server. no need for database ( for simplisity ).

anybody can help me and write me this piece of code



Answer this question

C# networking help

  • Gaston Faq.be

    i am using socket programming.

    after logging on the server, the client have to select a file and upload it to a shared directory on the server.

    clients can also download files from the shared directory on the server.

    uploaded files on the shared directory can be deleted only by server administrator or by the user who uploaded them.

    all connections must be done using TCP except file transferring should be done with UDP.

    this is in general what i wanna do in my program.

    thank you Sergey for your interest

    note : i am using Visual C#, and not the console application.


  • Vanna

    thnx S.G..

    i know that UDP gives me no guarantee...

    but out instructor wanna us to use it, and -as i told u- add some features to it to sumbit the packets in order, and resend the lost packets.... etc.

    i know also that i have to split the file.. and i am planning to do it.

    i'll continue doing my project.. and if i have more questions, i'll post here...

    thank you very much again.


  • Kimia

    Hi!

    What technology do you want to use Sockets, Web services, WCF, Remoting First you must decide which one to use. To make decision you need to answer some quesitons, like this:
    • do you plan to exchange large data streams or short messages only
    • do you need real time communication or latency acceptable
    • do you need online connection or frequent connect/request/response/disconnect


  • supunf

    Thank you S.G..

     

    Actually... its not me who decide how to send the file, with TCP or with UDP. He is my instructor who decide.

    i'll use UDP and add some reliability to it by sending ACK back to the sender.

    thank you for your notes S.G.

    i did it by using a BynaryWriter and BynaryReader, that i can send the text to and from the server.

    but now am strugelling with the file.

    i am just a beginner in network programming, so do not be shocked if u see me ask silly question.

     

    thank you S.G again..


  • sevanoaks2005

    UDP for file transfer Typically this is TCP job. In fact this task can be done by FTP protocol, check System.Net.FtpWebRequest class.
    For you question - after client connect to server, it must send name-password and server must validate them. Generally this is nothing more special than sending a message. Check Socket.Send() and Socket.Receive() help in MSDN, it has samples. You can declare structure with message details and serialize it into MemoryStream, so you can send it.


  • serpentara

    There are is no silly questions

    UDP for transfer hmm... really strange idea. UDP have no guarantee of receiving order if I remember all correct. So you can receive parts of file in reverse and unpredictable order. Also UDP have limit of message size, while TCP use stream. So if you going to use UDP, you need to split file into parts, add part number into each and send it to client. Then reconstruct file and send ACK as you planned. Also you need to invite some kind of mechanics to client to notify server that some parts not received, UDP have no guarantee of transfer if I remember all correct.

    BTW, to send file you can use SendFile().


  • C# networking help