LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP( EXAM QUESTION ANYONE PLEASE CHECK IT ).

Solved!
Go to solution

Same mistakes and now you even mess up the execution order. As a first step follow ALL my suggestion and don't repost until you actually do.

 

You are clearly not ready to do a program like this. You can't just randomly connect things and expect it to work.

Start with some LabVIEW tutorials first. We won't do your homework or exams.

0 Kudos
Message 11 of 15
(1,373 Views)

sorry instead of timeout i changed into two modes as crlf

0 Kudos
Message 12 of 15
(1,371 Views)
Solution
Accepted by topic author balbal207

@balbal207 wrote:

sorry instead of timeout i changed into two modes as crlf


Why don't you start implementing my suggestions above instead?

 

We really don't care what you do unless you tell us the reason behind your actions and we can see even the slightest indication that you actually thought about the problem. Why would you do these changes? Makes absolutely no sense. In any case none of this is related to your main problems.

Message 13 of 15
(1,361 Views)

Here is all I will say. You do the rest:

 

  1. Place one big while loop. Almost all code belongs inside.
  2. Inside the loop, listen for connections forever. Don't wire the IP.
  3. If a connection occurs, read the first byte to determine how many more bytes to read. (since it is only one byte the remaining size cannot be larger than 255)
  4. Read the remaining bytes, using the size determined from step 3.
  5. Look at the first of the remaining bytes to determine the function.
  6. Depending on the function, parse the second to last byte of step 4 as needed
  7. respond to the server request, returning the relevant message to the client
  8. Write to the log
  9. Close the connection.
  10. Start over with step 2 using the loop placed in step 1.
  11. ad infinitum.

Make sure to wire all error terminals to ensure correct execution order of all the sequential operations. If an error occurs, handle it gracefully.

Message 14 of 15
(1,343 Views)

The above is not optimal, but should get you going.

 

A better way would be to create a listerner outside the loop (using "TCP create listener") and then wait for incoming connections using "TCP wait on listener". Do the communiations with the connection ID and close the connection when done. After the loop also close the listener ID.

 

Have a look at the shipping example TCP named service" for details.

0 Kudos
Message 15 of 15
(1,243 Views)