Click here to Skip to main content
15,892,965 members
Home / Discussions / Java
   

Java

 
GeneralRe: Java application to transfer files and folders Pin
saigowthami27-Apr-13 2:41
saigowthami27-Apr-13 2:41 
AnswerRe: Java application to transfer files and folders Pin
sriniprabhu27-Apr-13 2:01
sriniprabhu27-Apr-13 2:01 
GeneralRe: Java application to transfer files and folders Pin
saigowthami27-Apr-13 2:40
saigowthami27-Apr-13 2:40 
QuestionMultiple strings received on TCP socket Pin
Sachin k Rajput 10-Apr-13 0:43
Sachin k Rajput 10-Apr-13 0:43 
AnswerRe: Multiple strings received on TCP socket Pin
Richard MacCutchan10-Apr-13 1:31
mveRichard MacCutchan10-Apr-13 1:31 
GeneralRe: Multiple strings received on TCP socket Pin
Sachin k Rajput 10-Apr-13 1:47
Sachin k Rajput 10-Apr-13 1:47 
GeneralRe: Multiple strings received on TCP socket Pin
Richard MacCutchan10-Apr-13 2:27
mveRichard MacCutchan10-Apr-13 2:27 
AnswerRe: Multiple strings received on TCP socket Pin
jschell10-Apr-13 8:36
jschell10-Apr-13 8:36 
Indian Coder1989 wrote:
I'm creating a TCP server with which I'll receive few strings.


Then stop doing that.

TCP should be sending a message. That message contains data.

Your design would consist of creating a layer that does the following and ONLY the following.

-- Send
- Take in input object (path, message1, message2)
- Put that data into a message. As an EXAMPLE the pseudo representation is as follows

<header>: MSG
<string cnt>: 3
  <string1 len>: 15
  <string1 data>: /mypath/stuff01
  <string2 len>: 11
  <string2 data>: Message One
  <string3 len>: 13
  <string3 data>: Other Message


- Send the message

--Receive
- Wait for message
- Parse message into a list of strings. (3 in the above example)
- Put messages into expected output item (path, message1, messate2)

The above is a bit generalized. It could be less generalized or more so.

The important parts however are that
1. There is ONE message regardless of the data items (because presumably the data items are really part of one collection.)
2. The message defines the length (specifically the length of three strings and the total string count.)
3. The message is part of the communications API, it is not part of the rest of the application. The rest of the application does not know and does not care that the 'message' exists.
4. The rest of the application uses the communications API. It does know and does not care that TCP is being used.
GeneralRe: Multiple strings received on TCP socket Pin
Sachin k Rajput 10-Apr-13 20:31
Sachin k Rajput 10-Apr-13 20:31 
QuestionFile Path Problem Pin
Sachin k Rajput 9-Apr-13 22:36
Sachin k Rajput 9-Apr-13 22:36 
QuestionRe: File Path Problem Pin
Richard MacCutchan10-Apr-13 0:25
mveRichard MacCutchan10-Apr-13 0:25 
AnswerRe: File Path Problem Pin
Sachin k Rajput 10-Apr-13 0:45
Sachin k Rajput 10-Apr-13 0:45 
QuestionRead JNDI from c# Pin
Member 11184949-Apr-13 1:59
Member 11184949-Apr-13 1:59 
AnswerRe: Read JNDI from c# Pin
Richard MacCutchan9-Apr-13 5:16
mveRichard MacCutchan9-Apr-13 5:16 
GeneralRe: Read JNDI from c# Pin
Member 11184949-Apr-13 8:28
Member 11184949-Apr-13 8:28 
GeneralRe: Read JNDI from c# Pin
jschell9-Apr-13 9:19
jschell9-Apr-13 9:19 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan9-Apr-13 9:40
mveRichard MacCutchan9-Apr-13 9:40 
GeneralRe: Read JNDI from c# Pin
Member 111849410-Apr-13 22:55
Member 111849410-Apr-13 22:55 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan10-Apr-13 23:14
mveRichard MacCutchan10-Apr-13 23:14 
GeneralRe: Read JNDI from c# Pin
Member 111849410-Apr-13 23:21
Member 111849410-Apr-13 23:21 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan11-Apr-13 0:38
mveRichard MacCutchan11-Apr-13 0:38 
GeneralRe: Read JNDI from c# Pin
Member 111849411-Apr-13 0:42
Member 111849411-Apr-13 0:42 
SuggestionRe: Read JNDI from c# Pin
Prasad Khandekar2-May-13 19:49
professionalPrasad Khandekar2-May-13 19:49 
QuestionJava Program to accept input from user and then display output . Pin
Aman kumar routh4-Apr-13 3:35
Aman kumar routh4-Apr-13 3:35 
AnswerRe: Java Program to accept input from user and then display output . Pin
emadrefai4-Apr-13 6:20
emadrefai4-Apr-13 6:20 

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.