We calculate the complete T-matrices of pion-nucleon (πN ) scattering to the third order in heavy baryon SU(3)-flavor chiral perturbation theory. The baryon mass in the chiral limit M0 and the low-energy constants (LECs) are determined by fitting to phase shifts of πN and the experimental octet-baryon masses, simultaneously. By using these constants, we obtain the pion-and strangeness-nucleon sigma terms, σπN = (55.49 ± 3.61) MeV and σsN = (77.66 ± 43.65) MeV, respectively. With the two σ-term values, we find that a small strangeness content of the proton, y = 0.12 ± 0.07. The scattering lengths and the scattering volumes are predicted, which turn out to be in good agreement with those of other approaches and available experiment data. The contributions from the third order amplitudes are discussed in detail. We find that the contributions from the internal kaon lines of one-loop diagrams and the counterterms of the third order are sizeable. In addition, the issue of convergence is also discussed in detail.