# Getting 8 nulls in response to login

**URL:** <https://staging-discuss.dev.twitch.com/t/getting-8-nulls-in-response-to-login/3791>\
**Category:** API\
**Created:** [November 3, 2015, 7:18pm UTC](https://staging-discuss.dev.twitch.com/t/getting-8-nulls-in-response-to-login/3791 "2015-11-03T19:18:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MitchZinck](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@MitchZinck](https://staging-discuss.dev.twitch.com/u/MitchZinck)\
**Post date:** [November 3, 2015, 7:18pm UTC](https://staging-discuss.dev.twitch.com/t/getting-8-nulls-in-response-to-login/3791/1 "2015-11-03T19:18:54Z")

</div>

I am currently writing a twitch program in Java.

```
    socket = new Socket(SERVER, TWITCH_PORT);
    is = socket.getInputStream();
    os = socket.getOutputStream();
    inputStreamReader = new InputStreamReader(is, "UTF-8");
    outputStreamWriter = new OutputStreamWriter(os, "UTF-8");
    
    BufferedReader read = new BufferedReader(inputStreamReader);
    BufferedWriter writer = new BufferedWriter(outputStreamWriter);

    writer.write("PASS oauth:" + OAUTH);
    writer.flush();
    writer.write("NICK " + NICK);
    writer.flush();

    while(true) {
        String line = read.readLine();
        if(line != null) {
            System.out.println(read.readLine());
        }
    }

```

The program connects and then continues to receive a infinite amount of null responses. I am not sure what I did wrong? As the twitch API says I should recieve:

> :tmi.twitch.tv 001 twitch\_username :connected to TMI  
> :tmi.twitch.tv 002 twitch\_username :your host is TMI  
> :tmi.twitch.tv 003 twitch\_username :this server is pretty new  
> :tmi.twitch.tv 004 twitch\_username [tmi.twitch.tv](http://tmi.twitch.tv) 0.0.1 w n  
> :tmi.twitch.tv 375 twitch\_username :- [tmi.twitch.tv](http://tmi.twitch.tv) Message of the day -  
> :tmi.twitch.tv 372 twitch\_username :- not much to say here  
> :tmi.twitch.tv 376 twitch\_username :End of /MOTD command

Thanks

---

<div class="post-metadata">

**Author:** ![george](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/george/32/120_2.png) [@george](https://staging-discuss.dev.twitch.com/u/george)\
**Post date:** [November 3, 2015, 11:30pm UTC](https://staging-discuss.dev.twitch.com/t/getting-8-nulls-in-response-to-login/3791/2 "2015-11-03T23:30:36Z")

</div>

Each IRC line/command must must end with an ASCII carriage return and linefeed (\r\n). Try fixing that and see if there is any change.

---

<div class="post-metadata">

**Author:** ![MitchZinck](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@MitchZinck](https://staging-discuss.dev.twitch.com/u/MitchZinck)\
**Post date:** [November 4, 2015, 1:44am UTC](https://staging-discuss.dev.twitch.com/t/getting-8-nulls-in-response-to-login/3791/3 "2015-11-04T01:44:07Z")

</div>

Thanks man that worked. Getting a error logging in response now though

Edit: nevermind fixed it thanks for the help!

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [December 4, 2015, 1:44am UTC](https://staging-discuss.dev.twitch.com/t/getting-8-nulls-in-response-to-login/3791/4 "2015-12-04T01:44:10Z")

</div>

Closed on December 4, 2015, 1:44am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
