Ejemplo n.º 1
0
        protected internal override bool pollAccept(int peerMacAddr, int peerPortAddr, SceKernelThreadInfo thread)
        {
            bool acceptCompleted = false;

            try
            {
                AdhocSocket acceptedSocket = socket.accept();
                if (acceptedSocket != null)
                {
                    sbyte[] destMacAddress = proOnline.getMacAddress(acceptedSocket.ReceivedAddress);
                    if (destMacAddress != null)
                    {
                        // Return the accepted peer address and port
                        pspNetMacAddress peerMacAddress = new pspNetMacAddress(destMacAddress);
                        int    peerPort = acceptedSocket.ReceivedPort;
                        Memory mem      = Memory.Instance;
                        if (peerMacAddr != 0)
                        {
                            peerMacAddress.write(mem, peerMacAddr);
                        }
                        if (peerPortAddr != 0)
                        {
                            mem.write16(peerPortAddr, (short)peerPort);
                        }

                        // As a result of the "accept" call, create a new PTP Object
                        PtpObject ptpObject = new ProOnlinePtpObject(this);
                        // Add information about the accepted peer address and port
                        ptpObject.DestMacAddress = peerMacAddress;
                        ptpObject.DestPort       = peerPort;
                        ptpObject.Socket         = acceptedSocket;

                        // Add the received socket as a new Ptp Object
                        Modules.sceNetAdhocModule.hleAddPtpObject(ptpObject);

                        // Return the ID of the new PTP Object
                        setReturnValue(thread, ptpObject.Id);

                        //if (log.DebugEnabled)
                        {
                            Console.WriteLine(string.Format("accept completed, creating new Ptp object {0}", ptpObject));
                        }

                        acceptCompleted = true;
                    }
                }
            }
            catch (SocketTimeoutException)
            {
                // Ignore exception
            }
            catch (IOException e)
            {
                Console.WriteLine("pollAccept", e);
            }

            return(acceptCompleted);
        }
Ejemplo n.º 2
0
 public ProOnlinePtpObject(ProOnlinePtpObject ptpObject) : base(ptpObject)
 {
     proOnline = ptpObject.proOnline;
 }