Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

java client/ c server problem

Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got really wierd problem here and can't solve it.
i wrote client/server programm in java everything works fine, (both sides in c\c++ also ok), i am trying to make java client to work with c server, but got very strange bug(well i don't know how to call it)
this is code from client

is = new BufferedReader(new InputStreamReader(server.getInputStream()));
os = new PrintStream(server.getOutputStream());

String buffer = "name " + Login + " " +pswd;

// send first time

String buffer1 = is.readLine();

String comm = getCommand(buffer1);
StringTokenizer st = new StringTokenizer(buffer1);
ID = st.nextToken();
println("Yout ID - "+ID); //everything is fine here


buffer = "name " + Login + " " +pswd;
println("send one more time "+buffer);
//send second time
//this is for test purpose
String buffer2 = is.readLine();

println("X "+buffer2);
if(buffer == "ad") break;

now i'll try to explain what results i get
after i send first time i get such string back(response to that string)

second time i send SAME thig to the server i get 3 strings

sometimes before accept i get some garbage. i checked the server, but it send only the data i need (wrote the answer string byte by byte into file)
so my question would be wtf is happenning here ??
i would be really glad if you helped me, because i have no idea where the problem could be.
thank you in advance.
You didn't tell me he was so big. Unlike this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic