|
This is difficult to answer with the available information.
You did not show the code that is sending to the server.
So I can just guess that you are doing that before creating the input stream and the reader. Then the data from the server may have been received already and are discarded by calling Flush() .
I can only suggest to try it this way:
Stream streamIn = socket.InputStream.AsStreamForRead();
StreamReader reader = new StreamReader(streamIn);
while (true)
{
string response = await reader.ReadLineAsync();
}
If this does not help you should debug the client code.
|
|
|
|
|
Ah, I have got it working!
What I have done is added a '\r' (or '\n') to the end of the string of data being sent from my Server program (written in VS2010 C#). The data is now seen by the Client when the app is run on BOTH the Local & Remote Machine.
I dont need to '\r' character when sending FROM Client TO Server for the server to see the data.
Don't know why my program worked with VS2010 (client & server), but now has to be modded, to work with VS2015 Client. Guess as it now works, I am not too bothered!
Thanks for your time & help!
Mike
|
|
|
|
|
Fine to know that you have finally solved the problem.
The reason is quite simple:
You are using ReadLineAsync which reads line by line (until a new line character is received). So you won't get anything if there is no new line character. Your server code uses probably a different (not text / line oriented) method.
|
|
|
|
|
Hi,
I am looking for code sample in C# which I can use to login to a website programmatically.
I want to provide Username and Password through the code and it should go to the next page after Logging in.
Regards,
mba
|
|
|
|
|
|
|
In my application, I have to change the system date/time over and over to debug and test and use it.
The problem is, if I forget to change it back and edit a file "in the past", Visual studio doesnt know to recompile that file when I press F5.
Is there any to disable this behavior?
|
|
|
|
|
No, there is not way to turn it off.
This is the expected behavior because VS will try to save time by only compiling the files that have been updated since the last compile.
The solution is rather simple. Instead of hitting Build (F5 (start debugging) or F6 (build)), hit Build menu -> Rebuild Solution or Rebuild project and it'll rebuild the entire solution or project, including all dependencies.
|
|
|
|
|
|
Better yet, forget changing the time on the DEV machine all the time and just test the code in a virtual machine! That's how I would do it anyway.
|
|
|
|
|
This is the expected behavior of most if not all build system. You can always rebuild your solution...
But changing system time will causes problems. It might cause problems with source control or backup and many other things. If you really need to test your system at other time, it might be preferable to use another computer for that purpose or implement a time provider for your application that can be replaced for testing purpose.
You can also "touch" your file to update their last modification time.
Philippe Mori
|
|
|
|
|
Thank to all of yous , answers.
David
modified 18-Apr-16 12:47pm.
|
|
|
|
|
Does the user that you are logging in as have select permissions on the Login Table?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
|
For starters, don't do it like that!
There are so many things wrong here it's difficult to know where to start!
Let's go with the really big one: SQL Injection.
Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead. See here: xkcd: Exploits of a Mom[^]
The second one is nearly as big: Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^].
See here: http://www.commitstrip.com/wp-content/uploads/2013/09/Strips-Erreur-au-pilori-001-650-finalenglish.jpg[^]
Next, don't hardcode connection strings. They make it very difficult to test your code before you release it to production! Use settings or configuration files instead.
Finally, never attach a DB: it creates a local copy of the SQL Server instance in the Express edition only - it will fail in production.
And then - when you have fixed that lot - look at your connection string itself.
Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your config file.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
One of the advantages of a forum is learning from each other. You have deleted your original question.
Why?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
how to run the xml file (exe) as standalone application.how to run outside the bin folder.my application get crashed when it runs outside the project. i have developed windows application using xml file.
|
|
|
|
|
Member 12431701 wrote: i have developed windows application using xml file. XML is not a programming language, so it is most unlikely that you have developed a Windows application from it. Please edit your question, show the actual code that is failing and explain what happens.
|
|
|
|
|
An XML file isn't an exe - it isn't executable.
As to why you app doesn't work outside the debugging environment - we can't tell you without knowing a heck of a lot more about it. What does it do? How does it do it? When does it crash? How do you make it crash? What happens when it does crash? Are there any messages?
What have you tried to find out why it crashes?
Remember, we can't see your screen, access your HDD, or read your mind - and we have no access to your code or data at all.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: read your mind
You write that often and every time I think to myself, "now that's probably a good thing"
|
|
|
|
|
So do I ... so do I ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
to avoid confusion: a good thing you can't read one's mind
|
|
|
|
|
Member 12431701 wrote: my application get crashed when it runs outside the project. It requires all the files in the output-directory to be present. Did you just copy the executable?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
An xml file is not an exe, it can't be run, it can't be an application.
You have to explain what you have really done.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|