Thursday, November 4, 2010

04 November 2010 - Bonjour Completed! :D

Completed the last stage of our Bonjour application today! :D we were able to do the synchronization of the displays fairly quickly. After that we also spent quite some time on trying to solve the memory leaks that we have. Learnt quite a lot about the Leaks Instrument today. I guess we better do proper memory management next time as we code. If not, we would have to spent a lot of time trying to solve leaks, especially with big projects.

Tried solving the problem with UIAlertView's memory leak, but to no avail. It wasn't much of a big problem though. Found this link while looking for solutions, might come in handy next time :)

This application is just the cherry on the cake. Since we have completed the cherry, it's time for us to start working on the cake. We must complete the cake! Therefore, we are gonna start on OpenGL next week! Sounds fun. Hehe.

Wednesday, November 3, 2010

03 November 2010 - Bonjour, multiple iOS sending data to OSX (listener)

Started the day with the setting up of the MacBook Pro as we need a third simulator to simulate multiple iOS-es. While doing that, we did research on how to go about having our listener receive data from multiple iOS-es. Spent quite a long time trying to do research, but in the end, nothing much could be found. Therefore, we decided to try things out ourselves.

Currently, our application has only instance variables for one NSInputStream and one NSOutputStream. This definitely cannot cater for multiple users. Then I thought that since we have the stream delegate, adding the various different streams into an array whenever there is a new user would not be a problem. I went on to try that out and it really worked. Our server was able to receive data from multiple users.

However, there was still one problem. Data sent from multiple users were merged together as they were all making use of the same instance variable that we have on the server, which is used to store leftover data. We went on to research on how to get the client's device name the moment a connection is established. This way, we would be able to identify the different users and have individual NSInputStreams, NSOutputStreams, as well as leftover data for each user. We spent quite a long time trying to get an answer, but all we could do was to retrieve the client's IP address. From there, we reworked our application in such a way that it takes in the device's IP address instead of the name.

We managed to complete the second stage of the application today - having multiple iOS-es connecting and sending data to the listener (OSX). We would be working on the third stage tomorrow - one client sends data to the server, the server receives the data and sends this data to all connected clients, resulting in synchronized displays on the server, as well as all clients connected to the server.

Tuesday, November 2, 2010

02 November 2010

Kevin discussed with us on some of the things for us to work on. For now, we'll have to work with the Bonjour protocol where one Mac OSX would be the listener, and multiple iOS devices would be able to send data over for interactions to occur.

There are three stages to this. First, we'll have to setup the listener, which is the Mac OSX, and allow a single iOS device to connect to it - e.g. when iPad A does zooming, it would be reflected on the listener's display.

Next, we would have to work on having the listener listen to multiple iOS devices connecting to it - e.g. when iPad A does zooming, it would be reflected on the listener's display. When iPad B does zooming, it would be reflected on the listener's display as well.

Last, we would have to ensure that all devices connected to the listener would be synchronized - e.g. when iPad A does zooming, this would be reflected on the listener's display, as well as iPad B's display. When, iPad B does zooming, it would be reflected on the listener's display, as well as iPad A's display.

Here is the picture showing our milestones:

We have completed the first stage and are now setting up the MacBook Pro to be used in testing multiple iOS devices.

Monday, November 1, 2010

01 November 2010 - Bonjour Application, Verge of Completion?

Completed the splitting and merging of data packets today. It wasn't that much of a trouble. Once we got that going, we were able to solve the rest of our consistency problems over different devices.

After showing our application to Kevin, we are now tasked to include multi-point interactions for the application. Once this is done, version 0.1 of our application would be ready! :D

*edit*
Now we're facing problems with multi-point interactions. The buffer size for data is either too small, or too big. If we set the buffer size to 512, and multi-point interaction occurs, we get an error. If we set it to 1024, and single-point interaction occurs, our application would not run properly as we're sending only small amounts of data.

Friday, October 29, 2010

29 October 2010 - More Bonjour!

As the title says, more Bonjour. We decided to go for a different approach today - to change our server and make use of delegation.

We managed to get the connections set up properly and were able to send and receive data on the client and server side. But, we have one problem. Since we're doing asynchronous data transfer, when the different touch evens are being called rapidly, the data being sent would be merged even before it reaches the receiving end. When this happens, unarchiving the data would cause the program to have errors, and we would not be able to display the user interactions properly.

We tried to solve the problem by applying threading, which I thought would work. Still, it failed. We didn't try doing synchronous data transfer as it would be slow if many users were to connect at the same time. We even tried to skip the unarchiving for data which exceeds a certain number of bytes, which obviously isn't the right way -.- this caused the interface to become jerky as some of the user interactions would be skipped.

Therefore, after doing some research, we realized that manual splitting and merging of the data's bytes has to be done before unarchiving on the receiving end starts. All along we were working based on the misconception that the way we send or receive is incorrect. However, that's not the case. It's actually due the the network that we're sending our data through. If data is being sent at a very fast rate, the data packets tend to be merged on the network. It has got nothing to do with the way we send or receive. It's much more of what should be on the receiving end before unarchiving the data.

Hence, we'll try out the splitting and merging of data packets on Monday to see what happens.

28 October 2010 - Bonjour again

Continued working with Bonjour again. Cracked our heads for the whole day! At first we missed out the code on the listening socket, which led to us not being able to listen to connections coming in. Once we added that in, things worked. We managed to establish the connections today - client joining the server.

However, there seems to be something wrong as the client is able to send the touches to the server, but not the other way round. We suspect that it has got to do with something related to NSOutputStream. Since it's already quite late, we decided to read up more on Bonjour after work.

Wednesday, October 27, 2010

27 October 2010 - Bonjour

Worked on the Bonjour protocol today. Had to get this right as this would be the groundwork for our project that we'll be working on soon in time to come. This time, it would not be the same as the assignments that we did before. Gotta research and try to get things working on our own. Only until the three of us (Kevin, Zac and I) are unable to find a solution, then it can be considered that we failed to do what we wanted. Then that is when we think of alternatives.

Kevin's right, we got to learn to express ourselves more. If we are unable to express ourselves well, we would tend to get the wrong message across, resulting in poor communications. The project could be directed onto another path because we failed to express ourselves well enough. Learnt this important lesson from Kevin today. Thanks Kevin :)

Managed to publish the NSNetService properly today. Gonna work on multiple interactions tomorrow. Hope that we can come up with something good :)