Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Socket - send multiple lines
Re: Socket - send multiple lines [message #29830 is a reply to message #29817] Sat, 20 November 2010 23:46 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Honza: After a little research I understand where "if(*q=='\n')" can and cannot be used.

Reading a file for each char does read '\n' or whatever for different OS.

C++ "getline", Java "readline" or whatever for different languages is to get the line.

Some languages like C++ drops the '\n' (you don't see it when debugging) and replaces that with the required '\0' to terminate the string. If several lines are to be included in one string the '\0' needs to be replaced with '\n'. The '\0' needs to be retained or added at the end.

In Java the '\n' is read (you can see and manipulate it) but not included in the string unless the code specifically inserts it.

A string is a char buf. The difference on how it is referenced/used is just semantics.

What is sent through my socket is just a bunch of characters. My server code includes the parsing of the data received, if the server just received the data and another function did the parsing no changes to the server code would have been necessary.

I did get my socket server to work with the String/char buf that has a single line or multiple lines. The client just sends what it is told to send, no changes were required there.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using U++ without UppIDE
Next Topic: [ASK] IBM DB2 Connector
Goto Forum:
  


Current Time: Sun Jun 08 06:12:29 CEST 2025

Total time taken to generate the page: 0.04900 seconds