Click here to Skip to main content
15,993,109 members
Home / Discussions / C#
   

C#

 
AnswerRe: Print and Print Preview of Web Page not Working Properly in Microsoft Edge Browser Pin
RedDk3-Jul-24 6:54
RedDk3-Jul-24 6:54 
GeneralRe: Print and Print Preview of Web Page not Working Properly in Microsoft Edge Browser Pin
Fokwa Divine3-Jul-24 7:20
Fokwa Divine3-Jul-24 7:20 
GeneralRe: Print and Print Preview of Web Page not Working Properly in Microsoft Edge Browser Pin
RedDk3-Jul-24 7:54
RedDk3-Jul-24 7:54 
GeneralRe: Print and Print Preview of Web Page not Working Properly in Microsoft Edge Browser Pin
Fokwa Divine9-Jul-24 2:31
Fokwa Divine9-Jul-24 2:31 
Questionmulti tcp clients Pin
darinka2-Jul-24 10:56
darinka2-Jul-24 10:56 
AnswerRe: multi tcp clients Pin
OriginalGriff2-Jul-24 21:37
mveOriginalGriff2-Jul-24 21:37 
GeneralRe: multi tcp clients Pin
darinka3-Jul-24 2:05
darinka3-Jul-24 2:05 
AnswerRe: multi tcp clients Pin
jschell3-Jul-24 6:14
jschell3-Jul-24 6:14 
Doesn't matter how you 'think' about the design the following is true.

For TCP sockets there is always a 'server' and a 'client'.

The 'server' creates a listener port and waits for a connection.
The 'client' opens a socket to the server. So the client is the one that initiates the connection.

After a connection is created either side can send and receive requests. Although often the client is the one that sends most requests.

The above also means that the server must have an addressable IP address. Probably in your situation that will not matter but it does mean you will need to figure out what the servers IP address is.

-----------------------------
Now for your actual code whether your want the pc or arudino to be the server is up to you. (I know very little about the second but I expect it can act as both a server and client.)

However I suggest that you start your learning experience using the PC only. So you will have two programs that run on your PC. One is the server. One is the client.

You can google for examples of writing code exactly like that in C#.

After you have tested that a bit then I suggest again only on the PC that you simulate what you want to actually do using the sample code. So for example if you want to send a specific command to the arudino then add code to do that in the PC code (client probably) and then respond in a pseudo way on the other side of the PC code.

You might also want to figure out how to analyze problems while you are developing this.

So for example you might do the following
- PC server code to simulate arudino
- Command received: Health check. Returns 'ok'
- PC client code to send command
- Command send: Health check
- Use Console.WriteLine() to write the command to send (all information)
- Use socket code to send it
- Use socket code to recieve response
- Use Console.WriteLine to write the response (all information.)

You should also experiment with what happens when the IP address is wrong and what happens if the server is not running.

-----------------------------------------------------------------------
As additional suggest for quite a bit in the future for a full application relying on Console.WriteLine() is not workable. So investigate 'logging'. You should not do this until you are comfortable with sockets.
GeneralRe: multi tcp clients Pin
darinka3-Jul-24 6:59
darinka3-Jul-24 6:59 
QuestionHow I write this logic to check if string in a list and also checked ? Pin
Martin Adams 202326-Jun-24 13:07
Martin Adams 202326-Jun-24 13:07 
AnswerRe: How I write this logic to check if string in a list and also checked ? Pin
OriginalGriff26-Jun-24 18:24
mveOriginalGriff26-Jun-24 18:24 
GeneralRe: How I write this logic to check if string in a list and also checked ? Pin
Martin Adams 202327-Jun-24 1:46
Martin Adams 202327-Jun-24 1:46 
AnswerRe: How I write this logic to check if string in a list and also checked ? Pin
Richard Deeming27-Jun-24 2:35
mveRichard Deeming27-Jun-24 2:35 
GeneralRe: How I write this logic to check if string in a list and also checked ? Pin
Martin Adams 202327-Jun-24 2:46
Martin Adams 202327-Jun-24 2:46 
GeneralRe: How I write this logic to check if string in a list and also checked ? Pin
OriginalGriff27-Jun-24 3:55
mveOriginalGriff27-Jun-24 3:55 
QuestionProject structure with C# and EfCore Pin
nwbkn20-Jun-24 4:54
nwbkn20-Jun-24 4:54 
AnswerRe: Project structure with C# and EfCore Pin
jschell20-Jun-24 12:41
jschell20-Jun-24 12:41 
GeneralRe: Project structure with C# and EfCore Pin
nwbkn21-Jun-24 6:35
nwbkn21-Jun-24 6:35 
GeneralRe: Project structure with C# and EfCore Pin
Richard Andrew x6423-Jun-24 4:58
professionalRichard Andrew x6423-Jun-24 4:58 
GeneralRe: Project structure with C# and EfCore Pin
Waqas Khan 202427-Jun-24 2:22
Waqas Khan 202427-Jun-24 2:22 
QuestionC# Newbie, Database Programming Pin
JasonParker33320-Jun-24 2:03
JasonParker33320-Jun-24 2:03 
AnswerRe: C# Newbie, Database Programming Pin
OriginalGriff20-Jun-24 2:09
mveOriginalGriff20-Jun-24 2:09 
GeneralRe: C# Newbie, Database Programming Pin
JasonParker33320-Jun-24 3:18
JasonParker33320-Jun-24 3:18 
GeneralRe: C# Newbie, Database Programming Pin
OriginalGriff20-Jun-24 4:36
mveOriginalGriff20-Jun-24 4:36 
AnswerRe: C# Newbie, Database Programming Pin
Richard MacCutchan24-Jun-24 6:12
mveRichard MacCutchan24-Jun-24 6:12 

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.