Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

HITNO exeption c++.net

[es] :: C/C++ programiranje :: HITNO exeption c++.net

[ Pregleda: 2515 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Alisa
Sarajevo

Član broj: 19202
Poruke: 27
195.222.35.*



Profil

icon HITNO exeption c++.net 27.01.2004. u 15:30 - pre 246 meseci
sta znaci sljedece upozorenje:



assembly access specifier modified from 'private'

javlja mi ovo za sljedecu klasu:
Code:

public  __gc class Client
{
   public:
//Konstruktor
     Client();

//Polja
    Form1 * form;
    String *str1;
    bool clientStart;

// <summary>Polje za smjestanje porta koji se osluskuje</summary>
    static Int16 port;
// <summary>Polje za smjestanje IP adrese servera</summary>
    static String *ipadresa;
// <summary>Buffer za smjestanje poruke koja se salje</summary>
    static Byte msg[];
// <summary>Buffer za smjestanje poruke koja se prima</summary>
    static Byte ReadBuffer[];
// <summary>Velicina bafera</summary>
    static int numberOfBytesRead;
// <summary>String u koji se smjesta kompletan poruka za slanje</summary>
    static String* CompleteReceiveMessage; 
// <summary>Objekat za konektovanje klijenta na odredjeni port</summary>
    static TcpClient *objTcpClient;
// <summary>Objekat za slanje i prijem poruka sa strane klijenta</summary>
    static NetworkStream *objNetworkStream;
// <summary>Callback funkcija za kompletiranje prijema poruke kroz soket konekciju sa strane klijenta</summary>    
    static AsyncCallback * CallBackReceiveFunction;
// <summary>Callback funkcija za kompletiranje slanja poruke kroz soket konekciju</summary>
    static AsyncCallback * CallBackSendFunction;
//Metode
// <summary>Poziva se klikom na dugme 'Connect' za konekciju klijenta</summary>
     void ConnectClient(String *ip, Int16 i);
// <summary>Funkcija se vrti u petlji sve dok je klijent konektovan i prihvata poruke koje salje server</summary>
    void ClientReceive();
/// <summary>Kompletiranje asihronog prijema podataka </summary>
    void ReceiveComplete(IAsyncResult *ar);
// <summary>Kompletiranje asihronog slanja podataka</summary>    
    void SendComplete(IAsyncResult *ar);
   };



Unaprijed hvala
alisa
 
Odgovor na temu

leka
Dejan Lekić
senior software engineer, 3Developers
Ltd.
London, UK

Član broj: 234
Poruke: 2534
*.racasse.se

Sajt: dejan.lekic.org


+2 Profil

icon Re: HITNO exeption c++.net 27.01.2004. u 16:57 - pre 246 meseci
Daj nam ceo kod, a ne samo klasu.
Dejan Lekic
software engineer, MySQL/PgSQL DBA, sysadmin
 
Odgovor na temu

Alisa
Sarajevo

Član broj: 19202
Poruke: 27
195.222.35.*



Profil

icon Re: HITNO exeption c++.net 28.01.2004. u 07:36 - pre 246 meseci
E klasa koju sam ti poslala je smjestena u h file, evo saljem ti cpp file:
Code:

#include "stdafx.h"
#include "Client.h"
//#include "Form1.h"
using namespace Socket_multithread;

Client::Client()
{
    CallBackReceiveFunction=new AsyncCallback(this, ReceiveComplete);
    CallBackSendFunction=new AsyncCallback(this, SendComplete);
}
void Client::ConnectClient(String *ip, Int16 i)
{
try
{
    if(objNetworkStream==NULL) // provjerava da li je objNetworkStream vec kreiran
    {
        String * IP=ip;
        Int16 portTemp=i;
        objTcpClient=new TcpClient(IP, portTemp);  // konektuje klijenta kroz konstruktor bez pozivanja Connect
        objNetworkStream=objTcpClient->GetStream();  // uzima Network Stream za slanje i primanje poruka
        ClientReceive();    //zapocinje asihroni prijem podataka
    }
}
catch(Exception * e)
{
    MessageBox::Show(e->Message, S"Greska");
    
}
}

void Client::ClientReceive()
{
    if(objNetworkStream->CanRead && objNetworkStream!=NULL)
    {
        objNetworkStream->BeginRead(ReadBuffer, 0, ReadBuffer->Length, CallBackReceiveFunction, NULL);
    }
    else
        MessageBox::Show(S"Greska pri prijemu, nema poruka");
}

void Client::ReceiveComplete(IAsyncResult *ar)
{
    if(objNetworkStream->CanRead)
    {
        CompleteReceiveMessage=S"";
        numberOfBytesRead=objNetworkStream->EndRead(ar);
        CompleteReceiveMessage=Encoding::ASCII->GetString(ReadBuffer,0,numberOfBytesRead);
        //MessageBox::Show(CompleteReceiveMessage);
        int ind = form->txtKonverzacija->Items->Add(CompleteReceiveMessage);
        form->txtKonverzacija->TopIndex = ind;
        if(numberOfBytesRead!=0)
            ClientReceive();
        else
            MessageBox::Show(S"Server se diskonektovao");
    }
}

void Client::SendComplete(IAsyncResult * ar)
{
    objNetworkStream->EndWrite(ar);
}


Pokazivac na objekat ove klase koristi u sljedecoj klasi:

Code:

#pragma once

//#include "ServerSocket.h"
namespace Socket_multithread
{
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    /// <summary> 
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the 
    ///          'Resource File Name' property for the managed resource compiler tool 
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
    //__gc class ServerSocket;
__gc class Client;
__gc class ServerSocket;
public __gc class Form1 : public System::Windows::Forms::Form
    {    

    private: Client *cc;
    private: ServerSocket * serSocket;
public:
        Form1(void)
        {
             
            InitializeComponent();
        }
  
protected:
        void Dispose(Boolean disposing)
        {
            if (disposing && components)
            {
                components->Dispose();
            }
            __super::Dispose(disposing);
        }

         int port;
         String * ipadresa;
        // Socket_multithread::ServerSocket* serSoc;
            
         bool serverStart;
         bool clientStart;
private: System::Windows::Forms::Label *  label1;
private: System::Windows::Forms::TextBox *  txtPort;
private: System::Windows::Forms::TextBox *  txtPoruka;
private: System::Windows::Forms::Button *  btnListen;
private: System::Windows::Forms::Button *  btnDisconnect;
private: System::Windows::Forms::Button *  btnSend;
private: System::Windows::Forms::GroupBox *  groupBox1;
private: System::Windows::Forms::RadioButton *  rbtnServer;
private: System::Windows::Forms::RadioButton *  rbtnClient;
private: System::Windows::Forms::Label *  lbServer;
private: System::Windows::Forms::TextBox *  txtServer;
private: System::Windows::Forms::Button *  btnExit; 
public: System::Windows::Forms::ListBox *  txtKonverzacija;
private:
        /// <summary>
        /// Required designer variable.
        /// </summary>
        System::ComponentModel::Container * components;

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
void InitializeComponent(void);



private: System::Void rbtnServer_CheckedChanged_1(System::Object *  sender, System::EventArgs *  e);
            
private: System::Void rbtnClient_CheckedChanged(System::Object *  sender, System::EventArgs *  e);
             
private: System::Void btnListen_Click(System::Object *  sender, System::EventArgs *  e);
            

    };
}


alisa
 
Odgovor na temu

[es] :: C/C++ programiranje :: HITNO exeption c++.net

[ Pregleda: 2515 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.