Member Avatar for andylbh

Hi all, I've just started learning server and client communication using socket.
What I'm doing here is like a Search Engine.
Server stores data (from a textfile) , then client search and check it exists or not.
Everything works fine, but I can't seem to loop for multiple search. (Meaning after client search and get results, it will continue prompting user to search for something else, until user ends the program by entering 'end')
My application ends after I finished searching once.
Is there a solution to this?

Thanks in advance.

Recommended Answers

All 3 Replies

>>Is there a solution to this?

Yes, use a loop. Your question is too vague to be of much more help.

Member Avatar for andylbh

This is how I it to work:

Search for: abc
Found: abc

Search for: 123
Can't find 123

Search for: end
Good Bye!

I tried using a loop, but it just doesnt prompt me to search again, the client program just ended. Seems like my connection with the server/socket was closed. Is there a way to reopen connection/socket?

Please post the problem area of your code for further help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.