?

Log in

No account? Create an account
Hi everyone, I'm new here. I used to do IT at uni, a long long time… - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[Jan. 7th, 2007|09:31 pm]
LiveJournal Client Discussions
lj_clients
[sophiespo]
Hi everyone, I'm new here.

I used to do IT at uni, a long long time ago, I used to do a lot of programming, and I loved it. I'm doing a whole different course now, so that got put to the wayside.

I've always wanted to write my own LJ client, mostly because I'm never satisfied with any program I use (the common programmers curse - seeing the ways in which it can be better!). The only problem is, I never got past the trying to log in stage. It has just -never- worked for me. No matter what I try.

I've gone back to the basics, and am using Visual Basic .NET (I told you - basics!). I've read the documentation over and over again, and apart from noticing some bad grammar here and there, it's shining no new light on what I'm trying to do.

Can somebody please help me? This is what I've tried to do, and while relatively simple sounding, it just Will. Not. Do. It.

I have:

- created the TCP socket. It seems to connect fine to www.livejournal.com on port 80.
- sent the HTTP request stuff, as per http://www.livejournal.com/doc/server/ljp.csp.guide.intro.html says - so, the POST, Host, Content-type and Content-length.
- at the end of each line is either a vbCrLf code, or Chr(13) + Chr(10) (I've tried with both, but logically shouldn't be any different to each other?)
- after the content length, which I've set as the correct value, I put a blank line, then the "mode=login etc" line. Then another Cr Lf.

This responds with nothing. I remember, ages ago, I did it another way and it responded with something. It was the wrong value, and responded with an error, but I can't replicate it now.

I have my program listening on the incoming stream - I've tested it with a sample server to make sure that it will tell me if it receives any information.

I'm sorry to be such a complete newbie to this, but trust me, I wouldn't be asking if I hadn't already exhausted every possibility that I can think of. My head is this close: |-| to smashing against a wall, desk or whatever else is in reach. I've read back in this community before to try and find some answers, but can't.

Thanks in advance!
linkReply

Comments:
From: (Anonymous)
2007-01-07 12:45 pm (UTC)
IF you're not getting a response, it may mean that the server is expecting more data given the content-length header you gave it. Also, remember that \r\n (CrLf) counts as two charachters.
(Reply) (Thread)
From: sophiespo
2007-01-07 12:47 pm (UTC)
Ack. If that's my problem, then I'm seriously going to kick myself.
(Reply) (Parent) (Thread)
From: sophiespo
2007-01-07 12:49 pm (UTC)
Well, I added two characters onto the count in content length, but to no avail. I still get absolutely nothing coming through. *sigh*
(Reply) (Parent) (Thread)
[User Picture]From: soph
2007-01-08 10:09 am (UTC)
If the Content-Length is the problem, then it'll be that it's too *much*, not too *small*. Upon receiving the number of bytes you specify, the server will always respond; it'll ignore the extra bytes. (Actually, that's not strictly true; if you're keeping the connection open between requests then it'll stick around in the buffer, which can lead to problems.)

Try hythloday's suggestion of setting the Content-Length to 1 and see what happens.
(Reply) (Parent) (Thread)
From: sophiespo
2007-01-08 11:50 am (UTC)
I did that, and it didn't give me much joy. I changed the way I was doing it altogether, and have since managed to get it going. I think it was a combination of the content length not being the right size, the carriage return/line feed chars, and the fact that I was trying to use a threaded solution when, I should have remembered from a horribly nightmarish Java assignment back at uni, that threads can be a pain in the proverbial to manage properly!

Anyway. Its working now, and I'm reading up on the fotobuilder documentation so that I can add some of that functionality into my client, too.

Although, perhaps I did spend most of the day playing in Photoshop to make a nice little GUI for it! Shh..
(Reply) (Parent) (Thread)
[User Picture]From: hythloday
2007-01-07 01:38 pm (UTC)
Are you able to paste the complete HTTP request that you're sending to the server? If you can show us that, then that would be very useful.

If not, I suspect that you've calculated your content-length incorrectly (as I almost always do when I do it by hand) :) – try setting it to 1 and seeing what happens (the server should give you an error, but at least it'll talk to you).
(Reply) (Thread)