Click here to Skip to main content
15,900,439 members
Home / Discussions / C#
   

C#

 
GeneralRe: Advantages of standardizing development tools and environment Pin
Mokai9-Feb-09 9:59
Mokai9-Feb-09 9:59 
GeneralRe: Advantages of standardizing development tools and environment Pin
Ennis Ray Lynch, Jr.9-Feb-09 10:01
Ennis Ray Lynch, Jr.9-Feb-09 10:01 
QuestionProblem with creating login application Pin
enigma1719849-Feb-09 8:08
enigma1719849-Feb-09 8:08 
AnswerRe: Problem with creating login application Pin
Wendelius9-Feb-09 8:14
mentorWendelius9-Feb-09 8:14 
AnswerRe: Problem with creating login application Pin
Pete O'Hanlon9-Feb-09 8:45
mvePete O'Hanlon9-Feb-09 8:45 
QuestionHelp with my project Pin
cdpace9-Feb-09 8:04
cdpace9-Feb-09 8:04 
AnswerRe: Help with my project Pin
akidan9-Feb-09 9:59
akidan9-Feb-09 9:59 
GeneralRe: Help with my project Pin
cdpace10-Feb-09 2:51
cdpace10-Feb-09 2:51 
Hello, to recieve the data i am first waiting for the client to wrie all the data into the stream and then the server connects the network stream to the incoming socket and reads the data. Below i have pasted the code where the server is downloading the data from the client.

if (clientsocket != null)
{
//Retrieve Stream from the socket that is connected to the client machine
NetworkStream incomingNetworkStream = new NetworkStream(clientsocket);
//Output Stream which will be used to store the incoming file onto the machine's HDD
FileStream fsout = new FileStream(parser.TemporaryFilesPath + @"\database.zip", FileMode.OpenOrCreate, FileAccess.Write);

long size = Convert.ToInt64(incomigFileSize);
long rdby = 0;
int len = 0;

if (incomingNetworkStream.DataAvailable)
{
while (rdby < size)
{
//buffer to store a portion of the incoming file
byte[] buffer = new byte[1024];

len = incomingNetworkStream.Read(buffer, 0, buffer.Length);
fsout.Write(buffer, 0, buffer.Length);

rdby = rdby + len;
}
fsout.Flush();
fsout.Close();
isReading = false;

}
else
{

}



byte[] datatosend = Encoding.ASCII.GetBytes("TransferCompleet");
serverSendSocket.Send(datatosend, datatosend.Length, 0);
}

The problem is that sometimes the data isnt read correctly and i think because the client pc is not finsihed writing to the stream when the server starts reading from the stream.
GeneralRe: Help with my project Pin
akidan10-Feb-09 5:24
akidan10-Feb-09 5:24 
GeneralRe: Help with my project Pin
cdpace11-Feb-09 10:17
cdpace11-Feb-09 10:17 
AnswerRe: Help with my project Pin
Ennis Ray Lynch, Jr.9-Feb-09 9:59
Ennis Ray Lynch, Jr.9-Feb-09 9:59 
QuestionDeploy apllication with password protected database Pin
chatravin9-Feb-09 6:59
chatravin9-Feb-09 6:59 
AnswerRe: Deploy apllication with password protected database Pin
EliottA9-Feb-09 7:28
EliottA9-Feb-09 7:28 
Questionhow to add Radio button list instead of checkboxes in listview Pin
netJP12L9-Feb-09 6:10
netJP12L9-Feb-09 6:10 
AnswerRe: how to add Radio button list instead of checkboxes in listview Pin
musefan9-Feb-09 6:39
musefan9-Feb-09 6:39 
AnswerRe: how to add Radio button list instead of checkboxes in listview Pin
howlettt9-Feb-09 8:31
howlettt9-Feb-09 8:31 
QuestionConnecting to database Pin
kibromg9-Feb-09 5:54
kibromg9-Feb-09 5:54 
AnswerRe: Connecting to database Pin
Rob Philpott9-Feb-09 6:03
Rob Philpott9-Feb-09 6:03 
GeneralRe: Connecting to database [modified] Pin
kibromg9-Feb-09 6:16
kibromg9-Feb-09 6:16 
GeneralRe: Connecting to database Pin
Rob Philpott9-Feb-09 6:27
Rob Philpott9-Feb-09 6:27 
GeneralRe: Connecting to database Pin
kibromg9-Feb-09 6:33
kibromg9-Feb-09 6:33 
GeneralRe: Connecting to database Pin
Rob Philpott9-Feb-09 6:43
Rob Philpott9-Feb-09 6:43 
GeneralRe: Connecting to database Pin
kibromg9-Feb-09 6:57
kibromg9-Feb-09 6:57 
GeneralRe: Connecting to database Pin
Rob Philpott9-Feb-09 8:54
Rob Philpott9-Feb-09 8:54 
GeneralRe: Connecting to database Pin
kibromg9-Feb-09 23:41
kibromg9-Feb-09 23:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.