• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem sending string over TCP - String is split into two parts  RSS feed

Bjorn Christian Sebak
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a service that connects to a remove server using simple Java Sockets in order to retrieve some XML data. I am requried by the remove server to set up a simple Socket connection, and send a login string containing my username and password, before I start receiving data back from the remote server. The login string is on the format "login:myusername:mypassword". The problem is that the remote server gets the login string in two chunks (like "login:us" and "ername:mypassword", where the string is split seem to be pretty random), which means the authentication fails and I dont get any data back over the socket. I cannot for the life of me figure out why this is so.

I have tried other ways of connecting (using a Python script), which works fine. It seem to be a Java-issue for some reason.

Here is a bare-bone example of my code:

The server runs though a Solaris machine. Maybe that is the issue?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!